/* Lokale Einbindung der Schriftart Inter */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter_24pt-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/inter_24pt-Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/inter_24pt-ExtraBold.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('fonts/inter_24pt-Black.ttf') format('truetype');
}

/* Dein restlicher CSS-Code beginnt hier */
:root {
  /* Modern Soft Theme - Updated 09.11.2025 - Subtle Version */
  --bg: #FAFBFC; /* Very subtle gray-blue, almost white */
  --fg: #1F2937; /* Darker text for better contrast */
  --muted: #6B7280;
  --border-color: #E5E7EB; /* Neutral gray border */
  --ok: #10B981; /* Professional green (between old and mint) */
  --bad: #ef4444;  /* Red for failure */
  --miss: #e5e7eb; /* Light gray for missed */
  --bronze: #cd7f32;
  --silver: #aaa9ad;
  --gold: #daa520;
  --zebra-bg-dark: #e5e7eb;

  /* Text colors */
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;

  /* Background colors */
  --bg-secondary: #F3F4F6; /* Very subtle gray for secondary bg */
  
  /* Card colors */
  --card-bg: #FFFFFF; /* Pure white for cards */
  
  /* Accent color */
  --accent-color: #10B981; /* Professional green */

  /* Navigation Icon Shadows - Pixelart Characters */
  /* Harter Schatten: wenig Blur, hohe Opacity, großer Offset */
  --nav-icon-shadow-inactive: drop-shadow(3px 3px 1px rgba(0, 0, 0, 0.4));
  --nav-icon-shadow-active: drop-shadow(5px 5px 2px rgba(0, 0, 0, 0.45));

  /* Navigation Icon Active Position Offsets - alle auf Baseline */
  --nav-icon-offset-habits: 0px;
  --nav-icon-offset-stadtfest: 0px;
  --nav-icon-offset-analytics: 0px;
  --nav-icon-offset-erfolge: 0px;
}

html, body {
  margin: 0;
  min-height: 100vh;
  /* Dynamic gradient - set by JavaScript based on playground level */
  background: linear-gradient(135deg, #7a9641 0%, #819d42 25%, #94ad4e 50%, #9cb455 75%, #a8bf5f 100%);
  background-attachment: fixed; /* Gradient bleibt fixiert beim Scrollen */
  color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

body.modal-open {
    overflow: hidden;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
  padding-top: 70px; /* Extra space at top for header */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  background: transparent; /* Transparent, damit Gradient sichtbar ist */
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px; /* Larger, softer radius */
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Softer, more subtle shadow */
}

/* Calendar Card - Glasmorphism (Phase 3) */
#calendar-card {
  background: rgba(255, 255, 255, 0.15); /* Etwas mehr Opacity */
  backdrop-filter: blur(12px); /* GLASEFFEKT! */
  -webkit-backdrop-filter: blur(12px); /* Safari Support */
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08); /* Dezenter Schatten */
}

/* Calendar Card - White Text (Phase 4) */
#calendar-card h2 {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#calendar-card .calendar-header h2 {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#calendar-card .btn-nav {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#calendar-card .weekday {
  color: #FFFFFF;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#calendar-card .muted,
#calendar-card #legend-habits {
  color: #FFFFFF;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Calendar Day Tiles - Glasmorphism (Phase 5) */
#calendar-card .calendar-day {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: all 0.3s ease;
}

#calendar-card .calendar-day:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#calendar-card .calendar-day.today {
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#calendar-card .calendar-day.disabled {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.5;
  cursor: not-allowed;
}

#calendar-card .calendar-day.disabled:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

#calendar-card .day-number {
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  mix-blend-mode: normal;
  filter: none;
}

/* Calendar Legend - Glasmorphism (Phase 6) */
#calendar-card .legend-row {
  background: rgba(255, 255, 255, 0.1); /* Subtiler - weniger Opacity */
  backdrop-filter: blur(6px); /* Weniger Blur */
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15); /* Dezenterer Border */
  border-radius: 8px; /* Kleinerer Radius */
  padding: 6px 12px; /* Viel weniger Padding - kompakter! */
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Dezenterer Schatten */
}

#calendar-card .legend-row p {
  margin: 0; /* Kein Margin = weniger Höhe */
  font-size: 0.85rem; /* Kleinere Schrift */
}

/* Calendar Mobile Optimizations (Phase 7) */
@media (max-width: 600px) {
  #calendar-card {
    padding: 16px; /* Weniger Padding auf Mobile */
  }

  #calendar-card .calendar-header h2 {
    font-size: 1.2rem; /* Kleinerer Monat/Jahr Text */
  }

  #calendar-card .weekday {
    font-size: 0.7rem; /* Kleinere Wochentage */
  }

  #calendar-card .calendar-day {
    min-height: 50px; /* Kompakter auf Mobile */
    backdrop-filter: blur(6px); /* Weniger Blur für Performance */
    -webkit-backdrop-filter: blur(6px);
  }

  #calendar-card .day-number {
    font-size: 0.7rem; /* Kleinere Zahlen */
  }

  #calendar-card .legend-row {
    padding: 4px 8px; /* Noch kompakter auf Mobile */
    font-size: 0.75rem;
  }

  #calendar-card .legend-row p {
    font-size: 0.75rem;
  }
}

/* ==========================================
   ANALYTICS TOGGLE BAR
   ========================================== */

.analytics-toggle-bar {
  display: flex;
  gap: 0; /* Kein Gap für Slider */
  padding: 4px;
  /* Papierlook mit Neumorphismus */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  margin-bottom: 20px;
  position: relative;
  /* Papier-Schatten: leicht erhaben */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Slider Pill (bewegt sich) */
.analytics-toggle-bar::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  /* Weißer Papier-Button der über dem Papier schwebt */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  /* Schwebender Schatten - Neumorphismus */
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* Pill Position wenn Statistics aktiv */
.analytics-toggle-bar.statistics-active::before {
  transform: translateX(calc(100% + 4px));
}

.analytics-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(0, 0, 0, 0.55); /* Schwarz/Grau für Lesbarkeit auf Papier */
  cursor: pointer;
  transition: color 0.3s ease;
  font-size: 0.9rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.analytics-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: stroke 0.3s ease;
}

.analytics-toggle-btn:hover {
  color: rgba(0, 0, 0, 0.75); /* Dunkler beim Hover */
}

.analytics-toggle-btn.active {
  color: rgba(0, 0, 0, 0.9); /* Tiefes Schwarz für aktiven Button */
  text-shadow: none; /* Kein Shadow nötig auf Papier */
}

/* ==========================================
   Language Toggle (DE / EN) - Paper Look
   ========================================== */

.lang-toggle-bar {
  display: flex;
  gap: 0;
  padding: 3px;
  /* Papierlook mit Neumorphismus */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  position: relative;
  /* Papier-Schatten: leicht erhaben */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Slider Pill (bewegt sich) */
.lang-toggle-bar::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 5px);
  height: calc(100% - 6px);
  /* Weißer Papier-Button der über dem Papier schwebt */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 7px;
  /* Schwebender Schatten - Neumorphismus */
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* Pill Position wenn EN aktiv */
.lang-toggle-bar.en-active::before {
  transform: translateX(calc(100% + 0px));
}

.lang-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: color 0.3s ease;
  font-size: 0.7rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
  text-shadow: none;
}

.lang-toggle-btn:hover {
  color: rgba(0, 0, 0, 0.75);
}

.lang-toggle-btn.active {
  color: rgba(0, 0, 0, 0.9);
  font-weight: 700;
}

/* Analytics Card uses same styling as calendar-card */
#analytics-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Apply calendar styling to analytics calendar view */
#analytics-card h2 {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#analytics-card .calendar-header h2 {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#analytics-card .btn-nav {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#analytics-card .weekday {
  color: #FFFFFF;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#analytics-card .muted,
#analytics-card #legend-habits {
  color: #FFFFFF;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#analytics-card .calendar-day {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: all 0.3s ease;
}

#analytics-card .calendar-day:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#analytics-card .calendar-day.today {
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#analytics-card .calendar-day.disabled {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.5;
  cursor: not-allowed;
}

#analytics-card .calendar-day.disabled:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

#analytics-card .day-number {
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  mix-blend-mode: normal;
  filter: none;
}

#analytics-card .legend-row {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 12px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#analytics-card .legend-row p {
  margin: 0;
  font-size: 0.85rem;
}

/* ==========================================
   ANALYTICS STATISTICS SUBTABS
   ========================================== */

.analytics-statistics-subtabs {
  display: flex;
  gap: 0; /* Kein Gap für Slider */
  padding: 4px;
  /* Papierlook mit Neumorphismus */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  margin-bottom: 20px;
  position: relative;
  /* Papier-Schatten: leicht erhaben */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Slider Pill für Subtabs */
.analytics-statistics-subtabs::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(33.333% - 5.33px);
  height: calc(100% - 8px);
  /* Weißer Papier-Button der über dem Papier schwebt */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  /* Schwebender Schatten - Neumorphismus */
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* Pill Positionen */
.analytics-statistics-subtabs.habits-active::before {
  transform: translateX(calc(100% + 4px));
}

.analytics-statistics-subtabs.history-active::before {
  transform: translateX(calc(200% + 8px));
}

.analytics-subtab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.55) !important; /* Schwarz/Grau für Lesbarkeit auf Papier */
  cursor: pointer;
  transition: color 0.3s ease;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  position: relative;
  z-index: 1;
}

.analytics-subtab-btn:hover {
  color: rgba(0, 0, 0, 0.75) !important; /* Dunkler beim Hover */
}

.analytics-subtab-btn.active {
  color: rgba(0, 0, 0, 0.9) !important; /* Tiefes Schwarz für aktiven Button */
  text-shadow: none !important; /* Kein Shadow nötig auf Papier */
}

/* Statistics Content - Glasmorphism */
#analytics-statistics-view .statistics-header {
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#analytics-statistics-view .chart-header,
#analytics-statistics-view .chart-title,
#analytics-statistics-view .chart-average,
#analytics-statistics-view .chart-date-range,
#analytics-statistics-view .grid-header {
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#analytics-statistics-view .statistics-chart-section {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

#analytics-statistics-view .chart-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
}

#analytics-statistics-view .chart-period-toggles {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

/* OLD STYLES REMOVED - Now using paper-look styles below (line ~816+) */

/* Grid View */
#analytics-statistics-view .chart-365-grid {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}

#analytics-statistics-view .grid-days-label,
#analytics-statistics-view .grid-date-range {
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Habit Cards in Statistics */
#analytics-statistics-view .habit-card,
#analytics-statistics-view .statistics-habit-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

#analytics-statistics-view .habit-card h3,
#analytics-statistics-view .statistics-habit-card h3 {
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Keep old statistics-card hidden */
#statistics-card,
#calendar-card {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
}

/* ==========================================
   ANALYTICS STATISTICS - TEXT OPTIMIZATION
   ========================================== */

/* Override all text colors in statistics view */
#analytics-statistics-view * {
  color: #FFFFFF;
}

#analytics-statistics-view .statistics-header-label {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

#analytics-statistics-view .statistics-header-value {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  font-weight: 900;
}

#analytics-statistics-view .statistics-header-value .days-label {
  color: rgba(255, 255, 255, 0.9);
}

/* Metrics */
#analytics-statistics-view .metric-value,
#analytics-statistics-view .metric-label,
#analytics-statistics-view .statistics-metric {
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#analytics-statistics-view .metric-label {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* KPI Grid */
#analytics-statistics-view .statistics-kpi-item {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px;
}

#analytics-statistics-view .kpi-label {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#analytics-statistics-view .kpi-value {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Statistics Header Grid */
#analytics-statistics-view .statistics-header {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

#analytics-statistics-view .statistics-kpi-grid {
  gap: 12px;
}

/* Text Elements */
#analytics-statistics-view p,
#analytics-statistics-view span,
#analytics-statistics-view h3,
#analytics-statistics-view h4 {
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Exception: Subtab buttons use black text on paper */
#analytics-statistics-view .analytics-subtab-btn,
#analytics-statistics-view .analytics-subtab-btn span {
  color: rgba(0, 0, 0, 0.55) !important;
  text-shadow: none !important;
}

/* Exception: Habit card toggle buttons use black text on paper */
#analytics-statistics-view .habit-card-toggle-btn,
#analytics-statistics-view .habit-card-toggle-btn span {
  color: rgba(0, 0, 0, 0.55) !important;
  text-shadow: none !important;
}

#analytics-statistics-view .habit-card-toggle-btn:hover {
  color: rgba(0, 0, 0, 0.75) !important;
}

#analytics-statistics-view .habit-card-toggle-btn.active {
  color: rgba(0, 0, 0, 0.9) !important;
}

#analytics-statistics-view .analytics-subtab-btn:hover,
#analytics-statistics-view .analytics-subtab-btn:hover span {
  color: rgba(0, 0, 0, 0.75) !important;
}

#analytics-statistics-view .analytics-subtab-btn.active,
#analytics-statistics-view .analytics-subtab-btn.active span {
  color: rgba(0, 0, 0, 0.9) !important;
}

/* Muted text (like labels) */
#analytics-statistics-view .muted,
#analytics-statistics-view [class*="label"],
#analytics-statistics-view [class*="text-secondary"] {
  color: rgba(255, 255, 255, 0.8) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Strong values (numbers) */
#analytics-statistics-view strong,
#analytics-statistics-view [class*="value"],
#analytics-statistics-view .stat-number {
  color: #FFFFFF !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  font-weight: 700;
}

/* ==========================================
   ANALYTICS SLIDERS - SWIPE/DRAG SUPPORT
   ========================================== */

.analytics-toggle-bar,
.analytics-statistics-subtabs {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y; /* Allow vertical scrolling but capture horizontal */
}

.analytics-toggle-bar:active,
.analytics-statistics-subtabs:active {
  cursor: grabbing;
}

.analytics-toggle-btn,
.analytics-subtab-btn {
  pointer-events: none; /* Buttons don't interfere with drag */
}

/* Re-enable pointer events for buttons when not dragging */
.analytics-toggle-bar > .analytics-toggle-btn,
.analytics-statistics-subtabs > .analytics-subtab-btn {
  pointer-events: auto;
}

/* ==========================================
   REVIEW/ERFOLGE CARD - GLASOPTIK
   ========================================== */

/* Review Card (Erfolge) uses same glassmorphism as analytics-card */
#review-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  /* Override CSS variables for text colors */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.9);
  --text-muted: rgba(255, 255, 255, 0.7);
  --bg-secondary: rgba(255, 255, 255, 0.15);
  --bg: rgba(255, 255, 255, 0.08);
}

/* Review Card Headers - White with shadow */
#review-card h2,
#review-card h3 {
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Review Card Labels - White with shadow */
#review-card .badge-content h3,
#review-card .badge-content div,
#review-card .stat-label,
#review-card .muted,
#review-card .milestone-item div,
#review-card span,
#review-card p {
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Exception: Review-Tab buttons use black text on paper */
#review-card .review-tab,
#review-card .review-tab span {
  color: rgba(0, 0, 0, 0.55) !important;
  text-shadow: none !important;
}

#review-card .review-tab:hover,
#review-card .review-tab:hover span {
  color: rgba(0, 0, 0, 0.75) !important;
}

#review-card .review-tab.active,
#review-card .review-tab.active span {
  color: rgba(0, 0, 0, 0.9) !important;
}

/* Badge Items - Glass effect */
#review-card .badge-item,
#review-card .milestone-item {
  background: rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Museum Toggle Buttons - Glass effect */
#review-card .museum-toggle-buttons {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================
   ANALYTICS - ICON COLORS FIX
   ========================================== */

/* Calendar Legend Icons - White */
#analytics-card .legend-row svg,
#analytics-card .legend-row img,
#analytics-card #legend-habits svg,
#analytics-card #legend-habits img {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

/* Statistics Habit Icons - White */
#analytics-statistics-view svg,
#analytics-statistics-view img.habit-icon,
#analytics-statistics-view .icon-wrapper svg,
#analytics-statistics-view .icon-wrapper img {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

/* Chart Period Buttons - BETTER CONTRAST */
#analytics-statistics-view .chart-period-toggles {
  /* Papierlook mit Neumorphismus */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 4px;
  gap: 0; /* Kein Gap für Slider */
  position: relative;
  /* Papier-Schatten: leicht erhaben */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Weißer Schieberegler für Chart-Period (5 Buttons) - JavaScript-gesteuert */
#analytics-statistics-view .chart-period-toggles::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(20% - 4px); /* 5 Buttons = 20% Breite */
  height: calc(100% - 8px);
  /* Weißer Papier-Button der über dem Papier schwebt */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  /* Schwebender Schatten - Neumorphismus */
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  /* Position wird via JavaScript gesetzt (--pill-offset) */
  transform: translateX(var(--pill-offset, 0px));
}

#analytics-statistics-view .chart-period-btn {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(0, 0, 0, 0.55) !important; /* Schwarz/Grau für Lesbarkeit auf Papier */
  cursor: pointer;
  transition: color 0.3s ease;
  font-weight: 600;
  text-shadow: none !important;
  position: relative;
  z-index: 1;
}

#analytics-statistics-view .chart-period-btn:hover {
  color: rgba(0, 0, 0, 0.75) !important; /* Dunkler beim Hover */
}

#analytics-statistics-view .chart-period-btn.active {
  color: rgba(0, 0, 0, 0.9) !important; /* Tiefes Schwarz für aktiven Button */
  font-weight: 700;
}

#analytics-statistics-view .chart-period-btn svg {
  filter: brightness(0); /* Schwarz für Lesbarkeit */
}

/* ==========================================
   ANALYTICS - CHART TEXT WHITE
   ========================================== */

/* Chart.js Canvas Text (Achsenbeschriftungen) */
#analytics-statistics-view .chart-container canvas {
  /* Chart.js uses JS to render, we'll handle this in JS */
}

/* Chart Labels, Axes, Grid */
#analytics-statistics-view .chart-title,
#analytics-statistics-view .chart-average,
#analytics-statistics-view .chart-date-range,
#analytics-statistics-view .chart-label,
#analytics-statistics-view .chart-axis-label {
  color: #FFFFFF !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Grid Labels */
#analytics-statistics-view .grid-days-label,
#analytics-statistics-view .grid-date-range,
#analytics-statistics-view .grid-label {
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

header {
  text-align: center;
  margin-bottom: 14px;
  padding-top: 16px;
  padding-bottom: 12px;
  position: relative;
  z-index: 200;
  background: transparent;
}

.language-switcher {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}
.language-switcher select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

h1 {
  margin: 0 0 6px;
  font-weight: 900;
  font-size: clamp(1.5rem, 2.2vw + 1rem, 2.2rem);
}

h2 {
  font-weight: 800;
  font-size: 1.25rem;
}

h3.section-header {
    text-align: left;
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.preset-category-header {
    background-color: #f3f4f6;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.checkin-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  margin: 6px 0;
}

/* --- Check-in Styles --- */
.habit-button-container.split-view {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.split-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex-grow: 1;
}
.split-actions.single-action {
    grid-template-columns: 1fr;
}
.split-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}
.habit-button-container.inactive-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
    border-radius: 8px;
    background-color: #f8f9fa;
    color: var(--muted);
    font-weight: 700;
}
.inactive-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}
.habit-info-icon.inactive {
    color: var(--muted);
    font-size: 1.2rem;
}
.habit-info-icon.inactive:hover {
    color: var(--fg);
}
.inactive-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.pattern-info {
    font-size: 0.8rem;
    color: var(--muted);
}
.due-date-info {
    font-size: 0.9rem;
    font-weight: 700;
}
.checkin-row-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: none;
  background-color: var(--card-bg);
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-icon {
    padding: 8px 12px;
    width: auto;
    font-size: 1.2rem;
    line-height: 1;
}

#btn-manage-habits {
    width: auto !important;
    display: inline-block !important;
    padding: 10px 20px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    background-color: #10b981 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.btn:hover:not(:disabled) {
  background-color: var(--fg);
  color: var(--bg);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-ok:not(:hover) { 
  background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
  color: white; 
  border: none;
  box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
  transition: all 0.2s ease;
}

.btn-ok:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.btn-bad:not(:hover) { 
  background: linear-gradient(135deg, #EF5350 0%, #E53935 100%);
  color: white; 
  border: none;
  box-shadow: 0 3px 8px rgba(244, 67, 54, 0.3);
  transition: all 0.2s ease;
}

.btn-bad:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}

.btn-confirm-reset, .btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-confirm-reset:hover, .btn-danger:hover { background-color: var(--bad); color: var(--bg); }

.status-done {
    border: 1px solid var(--border-color);
    border-radius: 12px; /* Rounder */
    padding: 14px; /* More padding */
    font-weight: 700;
    margin-bottom: 0;
    text-align: center;
    background-color: var(--card-bg);
    color: var(--fg);
}

.status-done.ok {
    border-color: var(--ok);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(22, 163, 74, 0.15) 10px, rgba(22, 163, 74, 0.15) 20px);
}

.status-done.bad {
    border-color: var(--bad);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(239, 68, 68, 0.15) 10px, rgba(239, 68, 68, 0.15) 20px);
}

/* --- Counter Button Styles --- */
.btn-counter {
    background-color: var(--bad);
    border: none;
    color: var(--fg);
    padding: 12px 16px;
    transition: all 0.3s ease;
}
.btn-counter .progress-bar {
    background-color: var(--ok);
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    z-index: 1;
    border-radius: 6px;
}
.btn-counter .progress-bar.limit {
    background-color: var(--bad);
    left: auto;
    right: 0;
}
.btn-counter .progress-text {
    position: relative;
    z-index: 2;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.btn-counter .ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    opacity: 0.1;
    z-index: 1;
}
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.popped { animation: pop 0.3s ease-out; }

/* --- Info Icon & Tooltip Styles --- */
.habit-button-container {
    position: relative;
    display: flex;
    align-items: center;
}
.habit-info-icon {
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--muted);
    margin-left: 10px;
    padding: 4px;
    line-height: 1;
    user-select: none;
}
.habit-info-icon:hover { color: var(--fg); }
.tooltip {
    visibility: hidden; width: 220px; background-color: var(--fg); color: var(--bg);
    text-align: center; border-radius: 6px; padding: 8px; position: absolute;
    z-index: 100; bottom: 125%; left: 50%; margin-left: -110px; opacity: 0;
    transition: opacity 0.3s; font-size: 0.85rem; font-weight: 400; line-height: 1.4;
    text-transform: none; letter-spacing: normal;
}
.tooltip::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: var(--fg) transparent transparent transparent;
}
.tooltip.visible { visibility: visible; opacity: 1; }

/* --- New Icon Tooltip System --- */
.icon-tooltip {
    position: fixed;
    background-color: var(--fg);
    color: var(--bg);
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 1000;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.icon-tooltip-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
}

.icon-tooltip-description {
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.9;
}

.icon-tooltip-description:empty {
    display: none;
}

.habit-icon-clickable {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    user-select: none;
}

.habit-icon-clickable:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.habit-icon-clickable:active {
    transform: scale(0.95);
}

#focus {
  margin-bottom: 22px;
}

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.metric-card {
  border: 1px solid var(--border-color); 
  border-radius: 12px; 
  padding: 24px; 
  display: flex;
  align-items: center; 
  justify-content: space-between; 
  gap: 24px; 
  transition: all 0.3s ease-in-out;
  position: relative;
  background-color: var(--bg);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.metric-card.streak-zero {
  background-color: #e8e8e8;
}

.metric-card.dark-bg,
.metric-card-horizontal.dark-bg,
.metric-card.dark-bg .streak-number,
.metric-card-horizontal.dark-bg .streak-number,
.metric-card.dark-bg .best-streak,
.metric-card-horizontal.dark-bg .best-streak,
.metric-card-horizontal.dark-bg .best-streak-number,
.metric-card.dark-bg .progress-ring-text,
.metric-card-horizontal.dark-bg .progress-ring-text,
.metric-card.dark-bg .habit-name,
.metric-card-horizontal.dark-bg .habit-name,
.metric-card.dark-bg .streak-title,
.metric-card-horizontal.dark-bg .streak-title,
.metric-card-horizontal.dark-bg .habit-name-header,
.metric-card-horizontal.dark-bg .current-streak-number,
.metric-card-horizontal.dark-bg .cell-streak,
.metric-card-horizontal.dark-bg .habit-info-text,
.metric-card-horizontal.dark-bg .metric-label {
    color: var(--bg);
}

.metric-card.dark-bg .streak-title.bronze,
.metric-card-horizontal.dark-bg .streak-title.bronze,
.metric-card.dark-bg .streak-title.silver,
.metric-card-horizontal.dark-bg .streak-title.silver,
.metric-card.dark-bg .streak-title.gold,
.metric-card-horizontal.dark-bg .streak-title.gold {
    color: var(--bg);
    opacity: 0.9;
}

.metric-card.dark-bg .habit-name .habit-info-icon,
.metric-card-horizontal.dark-bg .habit-name .habit-info-icon {
    color: #e5e7eb;
}
.metric-card.dark-bg .habit-name .habit-info-icon:hover,
.metric-card-horizontal.dark-bg .habit-name .habit-info-icon:hover {
    color: var(--bg);
}

.metric-card.dark-bg .progress-ring-bg,
.metric-card-horizontal.dark-bg .progress-ring-bg {
    stroke: rgba(255, 255, 255, 0.3);
}
.metric-card.dark-bg .progress-ring-notches circle,
.metric-card-horizontal.dark-bg .progress-ring-notches circle {
    stroke: rgba(255, 255, 255, 0.5);
}
.metric-card.dark-bg .progress-ring-border-outer,
.metric-card-horizontal.dark-bg .progress-ring-border-outer,
.metric-card.dark-bg .progress-ring-border-inner,
.metric-card-horizontal.dark-bg .progress-ring-border-inner {
    stroke: var(--bg);
}

/* Make SVG text white on dark backgrounds */
.metric-card-horizontal.dark-bg text,
.metric-card-horizontal.dark-bg svg,
.metric-card-horizontal.dark-bg .gauge-svg text {
    fill: var(--bg) !important;
}

/* Make buttons visible on dark background */
.metric-card-horizontal.dark-bg button svg {
    stroke: var(--bg);
    fill: none !important;
}

/* Make milestone info text white on dark background */
.metric-card-horizontal.dark-bg .cell-status > div,
.metric-card-horizontal.dark-bg [id^="next-milestone-"],
.metric-card-horizontal.dark-bg [id^="streak-title-"] {
    color: var(--bg) !important;
}

/* Make habit icon white on dark background */
.metric-card-horizontal.dark-bg .habit-icon-wrapper img,
.metric-card-horizontal.dark-bg .habit-icon-clickable {
    filter: brightness(0) invert(1);
}


/* --- Horizontal Card Layout --- */
.metric-card-horizontal {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    background-color: var(--bg);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden; /* Ensure content stays within rounded corners */
}

/* New 'Energy Flow' animation class */
.energy-flow-animation {
    border: 2px solid transparent; /* Make border thicker to be visible */
    --angle: 0deg;
    border-image: conic-gradient(from var(--angle), transparent, #3b82f6, transparent 25%) 1;
    animation: energy-flow 3s linear infinite;
}

/* Habit Name Header - positioned at top left with icon */
.habit-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.habit-card-header img {
    width: 22px;
    height: 22px;
}

.habit-name-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.habit-card-header button:first-of-type {
    margin-left: auto;
}

/* Grid Layout: 3 rows × 5 columns (POWER, STREAK, BOOST, BEST) */
.habit-card-content {
    display: grid;
    grid-template-columns: 120px 150px 90px 90px 1fr;
    grid-template-rows: auto auto auto;
    gap: 0;
    width: 100%;
    align-items: center;
}

/* Row 1, Col 1: Gauge */
.cell-gauge {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(0px);
}

.gauge-svg {
    display: block;
}

/* Row 1, Col 2: Streak Number */
.cell-streak {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Row 1, Col 3: Boost Number */
.cell-boost {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Row 1, Col 4: Best Number */
.cell-best {
    grid-column: 4;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Row 2, Col 1: Power Label */
.cell-label-power {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

/* Row 2, Col 2: Streak Label */
.cell-label-streak {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

/* Row 2, Col 3: Boost Label */
.cell-label-boost {
    grid-column: 3;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

/* Row 2, Col 4: Best Label */
.cell-label-best {
    grid-column: 4;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

/* Row 3, Col 1-4: Status Text */
.cell-status {
    grid-column: 1 / 5;
    grid-row: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 4px 12px 0 12px;
}

/* Number styling */
.current-streak-number {
    font-size: 74px;
    font-weight: 900;
    color: #1F2937;
    line-height: 1;
    text-align: center;
    margin-top: 0;
    position: relative;
    top: 30px;
}

.boost-number {
    font-size: 44px;
    font-weight: 800;
    color: #1F2937;
    line-height: 1;
    text-align: center;
    margin-top: 0;
    position: relative;
    top: 30px;
}

.best-streak-number {
    font-size: 44px;
    font-weight: 800;
    color: #1F2937;
    line-height: 1;
    text-align: center;
    margin-top: 0;
    position: relative;
    top: 30px;
}

/* Label styling */
.metric-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    line-height: 1;
}

/* Monochrome design - no colored backgrounds */
.metric-card-horizontal {
    background-color: var(--bg);
    padding: 12px 16px;
}

.metric-card-horizontal.streak-zero {
    background-color: #e8e8e8;
}

/* --- NEW: Combined Card Layout --- */
.metric-card-combined {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    background-color: var(--card-bg);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.25),
        0 4px 8px rgba(0, 0, 0, 0.18);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-card-combined.streak-zero {
    /* Background wird via JavaScript gesetzt (Gradient) */
}

/* Root Growth Overlay - Branch Images */
.root-branch-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    transition: opacity 0.5s ease;
}

/* Slightly increase opacity on hover for visual feedback */
.metric-card-combined:hover .root-branch-overlay {
    opacity: 0.5;
}

/* Color the branches - override black stroke */
.root-branch-overlay svg path {
    stroke: #6B4423; /* Dark brown for branches */
}

/* Optional: Different colors for light vs dark cards */
.metric-card-combined.dark-bg .root-branch-overlay svg path {
    stroke: #8B6635; /* Lighter brown for better contrast on dark backgrounds */
    opacity: 0.9;
}

/* Main Grid Layout */
.habit-card-main-grid {
    display: grid;
    grid-template-columns: 1fr; /* Nur 1 Spalte für Desktop */
    gap: 20px;
    align-items: start;
    position: relative;
    z-index: 1;
}

.habit-card-content-area {
    display: flex;
    flex-direction: column;
    gap: 0px; /* Desktop: kein Gap */
}

/* Header with Icon + Name + Buttons (smaller, shifted right) */
.habit-card-header-combined {
    display: flex;
    align-items: center;
    gap: 8px;
}

.habit-card-header-combined .habit-icon {
    flex-shrink: 0;
    width: 11px !important;
    height: 11px !important;
}

.habit-name-combined {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.habit-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.habit-action-btn:hover {
    opacity: 1;
}

/* Drag Handle for Habit Card Reordering - Zwei vertikale Striche nebeneinander */
.drag-handle {
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 50px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    z-index: 5;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

/* Die zwei vertikalen weißen Striche nebeneinander */
.drag-handle::before,
.drag-handle::after {
    content: '';
    width: 4px;
    height: 100px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
}

.drag-handle:hover {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Drop Target Indicator - shows where card will land */
.metric-card-combined.drop-target {
    border: 2px dashed #4f46e5 !important;
    background-color: rgba(79, 70, 229, 0.05) !important;
}

/* Dragging Clone Styles - Schwebt über anderen Karten */
.drag-clone {
    pointer-events: none;
    z-index: 10000;
    /* Mehrschichtiger Schatten für realistischen Schwebeffekt */
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.15),
        0 12px 24px rgba(0, 0, 0, 0.25),
        0 24px 48px rgba(0, 0, 0, 0.2) !important;
    /* Dezenter lila Rahmen */
    outline: 2px solid rgba(79, 70, 229, 0.4);
    outline-offset: -2px;
    border-radius: 16px;
}

/* Stats Container - rechtsbündig mit verschachteltem Layout */
.stats-container {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 28px;
    margin-bottom: 22px;
}

.pixel-art-container {
    width: 117px;
    height: 102px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-around;
    flex-shrink: 0;
    overflow: visible;
}

.pixel-art-image {
    width: 135px;
    height: 137px;
    border-radius: 11px;
    background: transparent;
    border: none;
    box-shadow: none;
    object-fit: contain;
    image-rendering: pixelated;
    align-self: flex-end;
    position: relative;
    left: -19px;
    top: 9px;
}

.stat-values-stacked {
    display: flex;
    flex-direction: column; /* Zahlen übereinander */
    gap: 8px;
    align-items: flex-end; /* Rechtsbündig */
    flex-shrink: 0;
}

/* Best-Box separat positionierbar */
.stat-values-stacked .stat-value-box:nth-child(2) {
    margin-left: 0px; /* Best-Zeile horizontal verschieben (anpassbar) */
}

.best-sliders-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1; /* Nimmt verfügbaren Platz rechts ein */
}

.stat-item-best {
    align-self: center;
    display: flex;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center; /* Zentriert die Icons vertikal */
    gap: 4px;
    flex: 0 0 auto;
}

.stat-value {
    font-size: 38px;
    font-weight: 800; /* Gleiche Stärke wie Power-Text */
    color: #000000; /* Schwarze Farbe */
    line-height: 1;
    height: 38px;
    display: flex;
    align-items: center;
}

/* Streak-Wert - jetzt gleich groß wie die anderen */
.stat-value-streak {
    font-size: 80px !important; /* Desktop: 80px - mit !important damit es nicht überschrieben wird */
    font-weight: 800;
    color: #000000;
    line-height: 1;
    height: 80px !important;
    display: flex;
    align-items: center;
}

/* Best-Wert - kleiner als Streak - muss NACH .stat-value kommen! */
.stat-value-best {
    font-size: 38px !important; /* Desktop: mittel */
    font-weight: 800;
    color: #000000;
    line-height: 1;
    height: 38px !important;
    display: flex;
    align-items: center;
}

/* Box für Streak, Best, Boost */
.stat-value-box {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center; /* Zentriert */
    gap: 6px;
}

.stat-with-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-tiny-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    line-height: 1;
}

.stat-icon {
    width: auto;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    transform: translateY(-8px);
    filter: brightness(0); /* Standard: Schwarz */
}

/* Icons behalten ihre Originalfarbe bei dunklem Hintergrund */
.metric-card-combined.dark-bg .stat-icon {
    /* Filter entfernt - Icons bleiben in Originalfarbe */
}

.stat-icon-best {
    height: 30px; /* Best-Icon kleiner als Streak-Icon */
}

.stat-label {
    font-size: 10px !important;
    color: #000000;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-gauge-mini {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 2.5rem;
}

/* Sliders Container - beide Slider + Labels */
.sliders-container {
    display: flex;
    gap: 8px;
    align-items: stretch; /* Dehnt sich auf volle Höhe */
    height: 100%; /* Nimmt volle Höhe des Parents */
    width: 100%; /* Nimmt volle Breite des Parents */
}

.sliders-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Wie Prototype: 16px statt 12px */
    flex: 1;
    justify-content: space-evenly;
    width: 100%;
}

.slider-with-label {
    display: flex;
    flex-direction: row; /* Labels VOR (links von) den Slidern */
    align-items: center; /* Vertikal zentriert */
    gap: 8px; /* Abstand zwischen Label und Slider */
    width: 100%; /* Volle Breite */
}

.slider-label-above {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #000000;
    line-height: 1;
    white-space: nowrap; /* Kein Umbruch */
    min-width: 50px; /* Feste Breite für Alignment */
}

.slider-labels {
    display: none; /* Alte Labels werden nicht mehr benötigt */
}

.stat-item-power {
    flex: 1; /* Nimmt verfügbaren Platz ein - Desktop */
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0; /* Kein Gap mehr - kein Spacer */
    min-height: 80px; /* Gleiche Höhe wie sliders-container */
}

.power-progressbar {
    width: 100%; /* Desktop: volle Breite des Parent-Containers */
    display: flex;
    align-items: center;
    height: 24px;
}

.power-progressbar-bg {
    width: 100%;
    height: 12px;
    background-color: #f5f5f5;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1.5px solid #6b7280;
}

.power-progressbar-segments {
    display: flex;
    height: 100%;
    gap: 2px;
    padding: 0;
    position: relative;
}

.power-segment {
    flex: 1;
    background-color: #e5e7eb;
    transition: background-color 0.3s ease;
}

.power-segment:first-child {
    border-radius: 999px 0 0 999px;
}

.power-segment:last-child {
    border-radius: 0 999px 999px 0;
}

.power-segment.filled {
    background-color: #ef4444;
}
    linear-gradient(90deg, 
        transparent 0%, 
        transparent calc(25% - 1px),
        #4b5563 calc(25% - 1px),
        #4b5563 calc(25% + 1px),
        transparent calc(25% + 1px),
        transparent calc(50% - 1px),
        #4b5563 calc(50% - 1px),
        #4b5563 calc(50% + 1px),
        transparent calc(50% + 1px),
        transparent calc(75% - 1px),
        #4b5563 calc(75% - 1px),
        #4b5563 calc(75% + 1px),
        transparent calc(75% + 1px)
    );
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 2px solid #000000;
}


.power-slider-content {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.power-slider-text-outside {
    font-size: 0.75rem;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.power-value-outside {
    font-size: 2rem;
    font-weight: 800;
    color: #000000;
    line-height: 1;
}

/* Boost Battery Slider */
.boost-battery {
    width: 100%; /* Desktop: volle Breite des Parent-Containers */
    display: flex;
    align-items: center;
    height: 24px;
}

.boost-battery-bg {
    width: 100%;
    height: 12px;
    background-color: #f5f5f5;
    border-radius: 999px;
    position: relative;
    overflow: hidden;
    border: 1.5px solid #6b7280;
}

.boost-battery-segments {
    display: flex;
    height: 100%;
    gap: 0;
    padding: 0;
    position: relative;
}

.boost-segment {
    flex: 1;
    background-color: #e5e7eb;
    border-radius: 2px; /* Leicht abgerundet */
    transition: background-color 0.3s ease;
    margin: 0 1px; /* Kleiner Abstand zwischen Segmenten */
}

.boost-segment:first-child {
    margin-left: 0;
}

.boost-segment:last-child {
    margin-right: 0;
}

.boost-segment.filled {
    background-color: #22c55e;
}

.boost-slider-content {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.boost-slider-text-outside {
    font-size: 0.75rem;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.boost-value-outside {
    font-size: 2rem;
    font-weight: 800;
    color: #000000;
    line-height: 1;
}

/* Points Bar */
.points-bar {
    width: 100%; /* Desktop: volle Breite des Parent-Containers */
    display: flex;
    align-items: center;
    height: 24px;
}

.points-bar-bg {
    width: 100%;
    height: 12px; /* Wie Prototype: 12px */
    background-color: #f5f5f5;
    border-radius: 999px; /* Wie Prototype: Vollständig abgerundet */
    position: relative;
}
    overflow: hidden;
    border: 2px solid #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.points-bar-values {
    font-size: 1.15rem; /* Desktop: größere Schrift */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 2;
    display: flex;
    flex-direction: row-reverse; /* Desktop: Reihenfolge umkehren */
    flex-wrap: nowrap;
    align-content: stretch;
    justify-content: space-around; /* Desktop: gleichmäßig mit Abstand */
    align-items: baseline;
    width: 100%; /* Volle Breite */
    padding: 0 16px; /* Abstand zu den Rändern */
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.points-success {
    color: #22c55e;
}

.points-fail {
    color: #ef4444;
}

.points-skip {
    color: #6b7280;
}

.points-divider {
    color: #666;
    font-weight: 400;
    display: none; /* Versteckt auf Desktop - Trenner nicht nötig bei space-between */
}

.points-slider-text-outside {
    font-size: 0.75rem;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.power-progressbar-text {
    font-size: 2rem; /* Größer: von 1.5rem auf 2rem */
    font-weight: 800;
    color: #000000; /* Schwarze Schrift */
    text-shadow: none; /* Kein Shadow mehr */
    white-space: nowrap;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

/* Prototype Layout: Stats Section */
.habit-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Prototype: Individual Stat Block */
.stat {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 6px;
}

/* Prototype: Streak Row */
.streak-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.streak-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.streak-label .inline-number {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--fg);
    font-size: 10px;
}

/* Make Streak number 3x larger */
.streak-label .inline-number.streak-number-large {
    font-size: 30px;
    font-weight: 800;
}

.streak-label .separator {
    opacity: 0.45;
}

/* Prototype: Points Row with Pills */
.points-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

@media (max-width: 600px) {
    .btn {
        padding: 16px 24px;
    }
    
    .points-row {
        display: flex !important;
    }
}

.points-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.points-label .inline-number {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--fg);
    font-size: 10px;
}

.points-label .separator {
    opacity: 0.45;
}

/* Prototype: Pills */
.pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
}

.pill.positive {
    background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
    color: #ffffff;
}

.pill.negative {
    background: linear-gradient(135deg, #EF5350 0%, #E53935 100%);
    color: #ffffff;
}

.pill.skip {
    background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
    color: #ffffff;
}

/* Badge Progress Text - Left Aligned */
.badge-progress-text {
    font-size: 10px;
    color: var(--fg);
    text-align: left;
    font-weight: 700;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

/* Action Buttons - Smaller */
.habit-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Status blocks in combined cards - same spacing as buttons */
.habit-action-buttons .habit-status-block {
    width: 100%;
    box-sizing: border-box;
}

.action-buttons-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-height: 33px; /* 75% von 44px = 33px */
    align-items: stretch;
}

.action-buttons-row .btn {
    padding: 8px 16px; /* Kleineres Padding für flachere Buttons */
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 33px; /* 75% von 44px = 33px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-buttons-row .btn.disabled,
.habit-action-buttons .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Dark background adjustments for combined card */
.metric-card-combined.dark-bg {
    color: var(--bg);
}

.metric-card-combined.dark-bg .habit-name-combined,
.metric-card-combined.dark-bg .stat-value,
.metric-card-combined.dark-bg .stat-label,
.metric-card-combined.dark-bg .badge-progress-text,
.metric-card-combined.dark-bg .slider-label-above,
.metric-card-combined.dark-bg .habit-icon-wrapper,
.metric-card-combined.dark-bg .streak-row,
.metric-card-combined.dark-bg .streak-label,
.metric-card-combined.dark-bg .points-label,
.metric-card-combined.dark-bg .inline-number {
    color: var(--bg);
}

.metric-card-combined.dark-bg .habit-action-btn svg {
    stroke: var(--bg);
}

/* Dark-bg: Edit und Delete Icons auch weiß machen */
.metric-card-combined.dark-bg .habit-card-header button svg {
    filter: brightness(0) invert(1);
}

/* Dark-bg: Habit Icon auch weiß machen */
.metric-card-combined.dark-bg .habit-icon-clickable {
    filter: brightness(0) invert(1);
}

.metric-card-combined.dark-bg .gauge-svg-mini text {
    fill: var(--bg) !important;
}

.metric-card-combined.dark-bg .power-progressbar-bg {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Placeholder Card for New Habits */
.habit-placeholder-card {
    border: 2px dashed var(--border-color); /* Use theme color */
    border-radius: 20px; /* Match other cards */
    padding: 34px 9px;
    background-color: transparent;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 112px;
}

.habit-placeholder-card:hover {
    border-color: var(--ok); /* Green on hover */
    background-color: rgba(52, 211, 153, 0.05); /* Soft green tint */
    transform: scale(1.01);
}

.placeholder-plus {
    font-size: 2.8rem;
    font-weight: 300;
    color: var(--ok); /* Green color */
    line-height: 1;
    margin-bottom: 7px;
    transition: all 0.3s ease;
}

.habit-placeholder-card:hover .placeholder-plus {
    color: var(--ok); /* Stay green */
    transform: scale(1.1); /* Bigger on hover */
}

.placeholder-text {
    font-size: 0.62rem;
    font-weight: 600;
    color: #FFFFFF; /* White text for better visibility on dynamic background */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.habit-placeholder-card:hover .placeholder-text {
    color: var(--ok); /* Green on hover */
}

/* Disabled state when 9 habits reached */
.habit-placeholder-card.disabled {
    border-color: #9ca3af; /* Medium gray border for better visibility */
    cursor: not-allowed;
    opacity: 1; /* Full opacity for better readability */
    background-color: #f9fafb; /* Subtle gray background */
}

.habit-placeholder-card.disabled:hover {
    border-color: #9ca3af; /* Stay gray */
    background-color: #f9fafb; /* Keep subtle background */
    transform: none; /* No scale */
}

.habit-placeholder-card.disabled .placeholder-plus {
    color: #6b7280; /* Darker gray for better contrast */
}

.habit-placeholder-card.disabled:hover .placeholder-plus {
    color: #6b7280; /* Stay darker gray */
    transform: none; /* No scale */
}

.habit-placeholder-card.disabled .placeholder-text {
    color: #4b5563; /* Much darker gray for excellent readability */
    font-weight: 500; /* Slightly bolder for clarity */
}

.habit-placeholder-card.disabled:hover .placeholder-text {
    color: #4b5563; /* Stay darker gray */
}

/* Maximum reached text */
.placeholder-max-text {
    font-size: 0.7rem;
    font-weight: 700; /* Bolder for better visibility */
    color: #b91c1c; /* Dark red with much better contrast */
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 8px;
    text-shadow: 0 0 1px rgba(185, 28, 28, 0.2); /* Subtle shadow for extra clarity */
}

/* Responsive: Keep horizontal layout but make it compact on mobile */
@media (max-width: 600px) {
    .metric-card-horizontal {
        padding: 12px;
        margin-bottom: 8px;
        border-radius: 8px;
    }

    .habit-card-header {
        gap: 8px;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    .habit-card-header img {
        width: 20px;
        height: 20px;
    }

    .habit-name-header {
        font-size: 0.9rem;
    }

    .metric-card-horizontal {
        padding: 10px 12px;
    }

    .habit-card-content {
        grid-template-columns: 90px 100px 60px 60px 1fr;
        grid-template-rows: auto auto auto;
        gap: 0;
    }

    /* Mobile adjustments for new combined card layout */
    .habit-card-main-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .reserved-space-left {
        display: none;
    }

    .metric-card-combined {
        padding: 20px;
        overflow-x: hidden;
        max-width: 100%;
    }

    .habit-card-content-area {
        gap: 0px; /* Mobile: Gap auf 0px */
        overflow-x: hidden; /* Mobile: Verhindert Überlaufen */
        max-width: 100%; /* Mobile: Nie breiter als Parent */
        overflow-y: visible; /* Mobile: WICHTIG - kein vertikales Abschneiden! */
    }

    .habit-card-header-combined .habit-icon {
        width: 10px !important;
        height: 10px !important;
    }

    /* Mobile: Drag Handle für Touch */
    .drag-handle {
        width: 28px;
        height: 45px;
        right: -18px;
    }

    .drag-handle::before,
    .drag-handle::after {
        width: 4px;
        height: 80px;
    }

    .habit-name-combined {
        font-size: 1.1rem;
    }

    .stats-container {
        gap: 4px; /* Mobile: Gap auf 4px */
        flex-wrap: nowrap;
        justify-content: space-between !important;
        padding-right: 0;
        max-width: 100%;
        overflow: visible !important; /* WICHTIG: Kein Abschneiden oben! */
        margin-bottom: 8px;
    }

    .best-sliders-group {
        margin-left: 0;
        margin-right: 0;
        flex: 1 1 auto; /* Nimmt verfügbaren Platz */
        min-width: 0; /* Erlaubt Schrumpfen */
        overflow: hidden;
        transform: translateY(12px) !important; /* 12px nach unten - FORCIERT */
    }

    .stat-values-stacked {
        width: auto; /* Flexibel statt fest 115px */
        min-width: 90px; /* Minimum */
        flex-shrink: 1; /* Darf schrumpfen */
        flex-direction: row; /* Mobile: Streak und Best nebeneinander */
        gap: 12px;
    }

    /* Mobile: Points-Slider ausblenden */
    .slider-with-label:last-child {
        display: none !important;
    }

    .pixel-art-container {
        min-width: 125px;
        border: none; /* Rahmen entfernt */
        position: relative; /* Für Positionierung */
    }

    .pixel-art-image {
        width: 121px;
        height: 127px;
        border-radius: 11px;
        border: none;
        box-shadow: none;
        position: relative;
        left: -16px;
        top: -7px;
        align-self: flex-end;
    }

    .badge-progress-text {
        margin-top: -5px; /* Mobile: nach oben verschieben */
    }

    .streak-row {
        gap: 8px;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .streak-label {
        font-size: 10px;
        gap: 4px;
        flex-shrink: 0;
    }

    .points-label .inline-number {
        font-size: 10px;
    }

    .pill {
        padding: 3px 10px;
        font-size: 11px;
    }

    .stat {
        gap: 2px;
    }
    
    .sliders-wrapper {
        gap: 8px; /* Mobile: Reduziert von 16px auf 8px */
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value-box {
        height: 36px;
    }

    .power-container {
        height: auto;
        gap: 4px;
    }

    .power-number-box {
        height: 36px;
        width: 50px;
    }

    .stat-item-power {
        width: auto;
        flex: 1 1 auto;
        min-width: 100px;
    }

    .power-progressbar {
        width: 138px !important; /* Mobile: Länger bis knapp vor Rand (iPhone 12 Pro Max @ 441px) */
        height: 13px;
    }

    .power-progressbar-bg {
        height: 10px; /* Mobile: 10px */
    }

    .boost-battery {
        width: 138px !important; /* Mobile: Länger bis knapp vor Rand (iPhone 12 Pro Max @ 441px) */
        height: 13px;
    }

    .boost-battery-bg {
        height: 10px; /* Mobile: 10px */
    }

    .points-bar {
        width: 138px !important; /* Mobile: Länger bis knapp vor Rand (iPhone 12 Pro Max @ 441px) */
        height: 13px;
    }

    .points-bar-bg {
        height: 10px; /* Mobile: 10px */
    }

    /* Mobile: Points zentriert mit Trennern */
    .points-bar-values {
        font-size: 0.75rem !important; /* Mobile: kleinere Schrift */
        flex-direction: row !important; /* Mobile: normale Reihenfolge */
        justify-content: center !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 0 !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: auto !important;
    }

    .points-divider {
        display: inline !important; /* Trenner auf Mobile sichtbar */
    }

    .action-buttons-row {
        gap: 6px;
    }

    .action-buttons-row .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .gauge-svg {
        width: 70px !important;
        height: auto !important;
    }

    .current-streak-number {
        font-size: 2rem;
    }

    .boost-number {
        font-size: 1.5rem;
    }

    .best-streak-number {
        font-size: 1.5rem;
    }

    .metric-label {
        font-size: 10px;
        margin-top: 2px; /* Points etwas nach unten für Ausrichtung mit Pills */
    }

    .cell-status {
        padding: 0 8px;
    }

    .cell-status div {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
    }
}

.habit-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    text-wrap: balance;
}

.habit-name .habit-info-icon {
    font-size: 1.2rem;
    margin-left: 0;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    user-select: none;
}
.habit-name .habit-info-icon:hover { color: var(--fg); }

.habit-name .tooltip {
    bottom: auto;
    top: calc(100% + 8px);
    left: 50%;
    margin-left: -110px;
}
.habit-name .tooltip::after {
    top: -10px;
    bottom: auto;
    left: 50%;
    margin-left: -5px;
    border-color: transparent transparent var(--fg) transparent;
}
.progress-ring { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.progress-ring-svg { transform: rotate(-90deg); width: 100%; height: 100%; }

.progress-ring-circle {
  transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
  fill: transparent;
  stroke-linecap: round;
  stroke-width: 14;
}

.progress-ring-bg { stroke: var(--miss); stroke-width: 14; fill: transparent; }
.progress-ring-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-weight: 700; font-size: 1.5rem;
}
.streak-display { text-align: center; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.streak-number {
  font-size: clamp(3.5rem, 16vw, 6rem); font-weight: 900; line-height: 1;
  letter-spacing: .5px; white-space: nowrap; color: var(--fg);
}
.streak-title {
  font-size: clamp(.9rem,1.5vw+.7rem,1.1rem); line-height: 1.2;
  text-wrap: balance; margin-top: 6px; min-height: 1.2em; /* Reserve space for milestone text */
}
.streak-title.bronze { color: var(--bronze); font-weight: 700; }
.streak-title.silver { color: var(--silver); font-weight: 700; }
.streak-title.gold { color: var(--gold); font-weight: 700; }
.best-streak { font-size: 0.85rem; color: var(--muted); margin-top: 8px; font-weight: 700; }
#calendar-card { display: flex; flex-direction: column; }
.calendar-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; width: 100%;
}
.calendar-header h2 { margin: 0; font-size: 1.5rem; text-align: center; flex-grow: 1; }
.btn-nav {
  background: transparent; border: none; font-size: 1.5rem; font-weight: bold;
  padding: 4px 12px; width: auto;
}
.btn-nav:hover:not(:disabled) { background-color: var(--miss); color: var(--fg); transform: none; box-shadow: none; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday { font-weight: 700; text-align: center; color: var(--muted); font-size: 0.8rem; padding-bottom: 10px; }
.calendar-day {
  min-height: 70px; border: 1px solid var(--border-color); border-radius: 6px; padding: 4px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; transition: background-color 0.3s ease; position: relative;
}
.calendar-day:hover { background-color: #f8f9fa; }
.calendar-day.disabled { cursor: not-allowed; background-color: #f8f9fa; opacity: 0.7; }
.calendar-day.disabled:hover { background-color: #f8f9fa; }
.calendar-day.other-month { visibility: hidden; }
.calendar-day.today {
  border: 2px solid var(--fg);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0, 0, 0, 0.08) 4px, rgba(0, 0, 0, 0.08) 8px);
}
.day-header { display: flex; justify-content: space-between; width: 100%; align-items: flex-start; }
.day-number {
  font-size: 0.8rem; font-weight: 700; color: var(--fg); mix-blend-mode: difference;
  filter: invert(1) grayscale(1) contrast(100); padding: 2px;
}
.day-awards { display: flex; gap: 2px; }
.day-awards span { font-size: 14px; }
.day-segments {
  display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 4px; height: auto; margin-top: auto;
}
.day-segments .seg {
  width: 20px; height: 20px; border-radius: 4px; display: flex;
  align-items: center; justify-content: center; font-size: 16px;
  position: relative;
}
.day-segments .seg .seg-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: brightness(0) invert(1); /* Make icon white */
}
.day-segments .seg.ok { background: var(--ok); }
.day-segments .seg.bad { background: var(--bad); }
.day-segments .seg.miss { background: var(--miss); }
.day-segments .seg.missed { background: #9ca3af; } /* Gray for forgotten rotating weekday habits */
.day-segments .seg.partial-success { background: linear-gradient(45deg, var(--ok) 50%, var(--bad) 50%); }
.day-segments .seg.not-due { background-color: transparent; border: 1px dashed var(--border-color); }
.dark-bg .day-segments .seg { background: transparent !important; border-width: 2px; border-style: solid; }
.dark-bg .day-segments .seg.ok:not(.badge) { border-color: #ffffff; }
.dark-bg .day-segments .seg.bad { border-color: #fca5a5; }
.dark-bg .day-segments .seg.miss { border-color: #a1a1aa; }
.dark-bg .day-segments .seg.missed { border-color: #9ca3af; }
.dark-bg .day-segments .seg.partial-success { background: linear-gradient(45deg, #ffffff 50%, #fca5a5 50%) !important; border: 2px solid #ffffff; }
.dark-bg .day-segments .seg.not-due { border-color: rgba(255, 255, 255, 0.3); }
.dark-bg .day-segments .seg.badge { border: none; }

/* Enhanced visibility for calendar days with dark backgrounds */
.calendar-day.dark-bg .day-number {
    color: #ffffff !important;
    mix-blend-mode: normal;
    filter: none;
}

.calendar-day.dark-bg:hover {
    filter: brightness(1.15);
}

.legend-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
#legend-habits span { display: inline-flex; align-items: center; position: relative; }
.legend-separator { margin: 0 8px; }
.playground-container {
  position: relative; width: 100%; aspect-ratio: 1 / 1; background-size: contain;
  background-repeat: no-repeat; background-position: center; border: 1px solid var(--border-color);
  transition: background-image 0.5s ease-in-out; background-color: #f0f0f0; border-radius: 8px;
}
#level-change-indicator { margin-left: 8px; font-weight: bold; }
.level-up { color: var(--ok); }
.level-down { color: var(--bad); }
.level-same { color: var(--muted); }
#danger .btn, #reset-modal .btn { width: auto; }
#settings-modal, #reset-modal, #edit-day-modal, #delete-modal, #delete-habit-dashboard-modal, #delete-habit-permanently-modal, #support-modal, #habit-stats-modal, #reminder-modal, #legal-modal, #logout-modal, #delete-account-modal, #onboarding-offer-modal {
  display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%;
  overflow: auto; background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center;
}
.modal-content {
  background-color: #fefefe; padding: 24px; border: 1px solid var(--border-color); border-radius: 12px;
  max-width: 500px; text-align: center; width: 90%; max-height: 90vh; overflow-y: auto;
}
#settings-modal .modal-content {
    background-color: var(--zebra-bg-dark);
}
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.setting-item, .edit-item { 
    background: var(--bg);
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 16px; 
    text-align: left;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    margin-bottom: 16px;
}

.setting-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.setting-item-header h4 { margin: 0; font-size: 1.1rem; }
.setting-item-actions { display: flex; gap: 8px; }
.archived-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.setting-item label, .edit-item-label { font-weight: 700; display: block; margin-bottom: 8px; }
.setting-item input[type="text"], .setting-item textarea, .setting-item input[type="number"], .edit-item input[type="number"] {
  width: 100%; padding: 8px; box-sizing: border-box; border: 1px solid var(--border-color);
  border-radius: 6px; font-size: 1rem; font-family: inherit;
}
.setting-item textarea { min-height: 80px; resize: vertical; }
.edit-controls { display: flex; gap: 10px; }
.edit-controls .btn { flex-grow: 1; }
.edit-controls .edit-count-input {
    width: 100px; text-align:center; font-size: 1.2rem; padding: 10px;
}
.edit-controls .btn, #settings-modal .btn, #delete-modal .btn { width: auto; }

.toggle-description {
    cursor: pointer;
    font-weight: 700;
    color: var(--fg);
    text-decoration: underline;
    margin-left: 4px;
}

.preset-buttons {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    margin-top: 16px !important;
    min-height: 100px !important;
}

.preset-buttons .btn {
    height: auto !important;
    min-height: 80px !important;
    width: auto !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: space-between !important;
    padding: 12px !important;
    text-transform: none !important;
    font-size: 0.85rem !important;
    background-color: var(--muted) !important;
    color: white !important;
    border: 1px solid var(--border-color) !important;
    text-align: left !important;
}

.preset-buttons .btn:hover:not(:disabled) {
    background-color: var(--fg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.preset-buttons .btn strong {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 4px;
    display: block;
}

.preset-buttons .btn small {
    font-size: 0.75rem;
    opacity: 0.8;
    line-height: 1.3;
}

.preset-buttons .btn .preset-type {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.9;
    align-self: flex-end;
    margin-top: 8px;
}


@media (max-width:900px){.grid{grid-template-columns:1fr}}
@media (max-width:600px){
    .grid, .settings-grid {grid-template-columns:1fr}
    .metric-card { text-align: center; gap: 24px; padding: 24px; flex-direction: column; }
    .progress-ring { width: 120px; height: 120px; }
    .streak-number { font-size: clamp(3rem, 20vw, 5rem); }
    .calendar-day { min-height: 60px; padding: 4px; }
    .day-number { font-size: 0.7rem; }
    .day-awards span { font-size: 12px; }
    .day-segments { gap: 2px; }
    .day-segments .seg { width: 12px; height: 12px; border-radius: 2px; font-size: 10px; }
    .day-segments .seg .seg-icon { width: 10px; height: 10px; }
    .language-switcher { top: 8px; right: 8px; }
    .preset-buttons { grid-template-columns: repeat(2, 1fr); }

    .btn {
        font-size: 0.7rem; /* Noch kleinere Schriftgröße für Mobilgeräte */
    }
}

/* --- Footer & Legal Links --- */
.page-footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  color: var(--muted);
  background: linear-gradient(to bottom, #d6e8d2, #f5e7d5); /* Desktop: Gradient wie body */
}

.footer-separator {
  margin: 0 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
}

.btn-link:hover {
  text-decoration: underline;
  color: var(--fg);
}

a.btn-link {
    text-decoration: none;
}

/* --- Style for text in legal modals --- */
.modal-content .text-block {
  text-align: left;
  line-height: 1.6;
}

.modal-content .text-block h3 {
  margin-top: 24px;
}

/* --- Style for new legal pages --- */
.legal-content {
  background: var(--bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  text-align: left;
  line-height: 1.6;
}

.legal-content h3 {
    margin-top: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    font-weight: 700;
    text-decoration: none;
    color: var(--fg);
}

.back-link:hover {
    text-decoration: underline;
}

/* --- Setup Page Custom Styles --- */
.setup-primary-card {
    background-color: var(--muted);
    color: var(--bg);
    border: none;
}
.setup-primary-card h2 { color: var(--bg); }
.setup-primary-card p.muted { color: #e5e7eb; }
.setup-primary-card .setting-item {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
.setup-primary-card .setting-item-header h4 { color: var(--bg); }
.setup-primary-card .setting-item-header .btn-danger {
    background-color: var(--bad); color: var(--bg); border: none;
}
.setup-primary-card .setting-item-header .btn-danger:hover { opacity: 0.8; }
.setup-primary-card .setting-item label { color: #d1d5db; }
.setup-primary-card .setting-item input[type="text"],
.setup-primary-card .setting-item textarea,
.setup-primary-card .setting-item select {
    background-color: rgba(0,0,0,0.2); color: var(--bg); border-color: rgba(255, 255, 255, 0.3);
}
.setup-primary-card .setting-item input[type="text"]:focus,
.setup-primary-card .setting-item textarea:focus,
.setup-primary-card .setting-item select:focus {
    outline: 2px solid var(--ok); border-color: var(--ok);
}
.setup-primary-card #btn-add-setup-habit {
    background-color: rgba(255, 255, 255, 0.1); color: var(--bg); border-color: rgba(255, 255, 255, 0.3);
}
.setup-primary-card #btn-add-setup-habit:hover { background-color: rgba(255, 255, 255, 0.2); }
#btn-finish-setup.btn-start {
    background-color: var(--ok); color: white; border-color: var(--ok); flex-grow: 1;
    font-size: 1.1rem; padding-top: 14px; padding-bottom: 14px;
}
#btn-finish-setup.btn-start:hover {
    background-color: #15803d; border-color: #15803d; color: white;
}
#btn-finish-setup.btn-start:disabled {
    background-color: rgba(0,0,0,0.2); border-color: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.4);
}

/* --- Habit Type & Frequency Styles --- */
.habit-type-selector {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px;
}
.type-btn {
    padding: 12px 8px; font-size: 0.8rem; text-transform: none; height: auto;
    white-space: normal; text-align: center; line-height: 1.3; border: 2px solid transparent;
}
.setting-item:not(.setup-primary-card .setting-item) .type-btn {
    background-color: #f3f4f6; color: var(--fg); border-color: var(--border-color);
}
.setting-item:not(.setup-primary-card .setting-item) .type-btn:hover { background-color: #e5e7eb; }
.setting-item:not(.setup-primary-card .setting-item) .type-btn.active {
    background-color: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 700;
}
.setup-primary-card .type-btn {
    background-color: rgba(0,0,0,0.2); color: #e5e7eb; border-color: rgba(255, 255, 255, 0.3);
}
.setup-primary-card .type-btn:hover { background-color: rgba(0,0,0,0.4); }
.setup-primary-card .type-btn.active {
    background-color: var(--bg); color: var(--fg); border-color: var(--bg); font-weight: 700;
}
.freq-options {
    margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.setting-item:not(.setup-primary-card .setting-item) .freq-options {
    border-top: 1px solid var(--border-color);
}
.sub-selector { grid-template-columns: 1fr 1fr !important; }

.freq-weekly-days {
    display: block;
    margin-top: 8px;
}
.freq-monthly-date {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 8px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
.freq-monthly-info {
    font-size: 0.8rem;
    margin-top: 8px;
    line-height: 1.4;
    text-align: center;
}
.day-btn {
    padding: 2px;
    font-size: 0.7rem;
    background-color: #f3f4f6;
    color: var(--fg);
    border: 2px solid var(--border-color);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.setup-primary-card .day-btn {
     background-color: rgba(0,0,0,0.2); color: #e5e7eb; border-color: rgba(255, 255, 255, 0.3);
}
.day-btn:hover { background-color: #e5e7eb; }
.setup-primary-card .day-btn:hover { background-color: rgba(0,0,0,0.4); }
.day-btn.active { background-color: var(--fg); color: var(--bg); border-color: var(--fg); }
.setup-primary-card .day-btn.active { background-color: var(--bg); color: var(--fg); border-color: var(--bg); }

.freq-weekly-count input[type="number"],
.freq-monthly-count input[type="number"],
.freq-weekly-days input[type="number"],
.freq-monthly-days input[type="number"] {
    width: 60px; padding: 8px; text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}
.setup-primary-card .freq-weekly-count input[type="number"],
.setup-primary-card .freq-monthly-count input[type="number"] {
    background-color: rgba(0,0,0,0.2);
    color: var(--bg);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Make input fields more visible in modals */
#settings-modal .freq-weekly-count input[type="number"],
#settings-modal .freq-monthly-count input[type="number"],
#settings-modal .freq-weekly-days input[type="number"],
#settings-modal .freq-monthly-days input[type="number"] {
    background-color: #f3f4f6;
    border: 2px solid #3b82f6;
    font-weight: 700;
}

/* Hide target input and text for simple habits */
.setting-item[data-habit-type="simple"] .target-inline-input-weekly-count,
.setting-item[data-habit-type="simple"] .target-inline-input-monthly-count,
.setting-item[data-habit-type="simple"] .target-inline-input-weekly-days,
.setting-item[data-habit-type="simple"] .target-inline-input-monthly-days,
.setting-item[data-habit-type="simple"] .target-inline-input-daily,
.setting-item[data-habit-type="simple"] .target-inline-input-weekly-count + span,
.setting-item[data-habit-type="simple"] .target-inline-input-monthly-count + span,
.setting-item[data-habit-type="simple"] .freq-weekly-days > div:last-child,
.setting-item[data-habit-type="simple"] .freq-monthly-days > div:nth-child(2),
.setup-primary-card[data-habit-type="simple"] .target-inline-input-weekly-count,
.setup-primary-card[data-habit-type="simple"] .target-inline-input-monthly-count,
.setup-primary-card[data-habit-type="simple"] .target-inline-input-weekly-days,
.setup-primary-card[data-habit-type="simple"] .target-inline-input-monthly-days,
.setup-primary-card[data-habit-type="simple"] .target-inline-input-daily,
.setup-primary-card[data-habit-type="simple"] .target-inline-input-weekly-count + span,
.setup-primary-card[data-habit-type="simple"] .target-inline-input-monthly-count + span,
.setup-primary-card[data-habit-type="simple"] .freq-weekly-days > div:last-child,
.setup-primary-card[data-habit-type="simple"] .freq-monthly-days > div:nth-child(2) {
    display: none !important;
}


/* Habit Wrapper with dashed border */
.habit-wrapper {
    border: 1px dashed var(--muted);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 12px;
    background: #ffffff;
}

.dark-bg .habit-wrapper {
    border-color: #6b7280;
}

/* Darker background only for the 'Dein Habit Check' section */
#checkin.card {
    background: #f1f3f4;
}

.dark-bg #checkin.card {
    background: #374151;
}

/* Habit info text under buttons */
.habit-info-text {
    text-align: left;
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 500;
}

/* Hide empty info text */
.habit-info-text:empty {
    display: none;
}

.dark-bg .habit-info-text {
    color: #9ca3af;
}

/* Unified button styles for completed states */
.btn-completed {
    background: var(--ok) !important;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.4) 4px,
        rgba(255, 255, 255, 0.4) 8px
    ) !important;
    color: #ffffff !important;
    border: 2px solid var(--ok) !important;
    font-weight: bold !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3) !important;
}

.btn-bad.btn-completed {
    background: var(--bad) !important;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.4) 4px,
        rgba(255, 255, 255, 0.4) 8px
    ) !important;
    color: #ffffff !important;
    border: 2px solid var(--bad) !important;
    font-weight: bold !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3) !important;
}

.btn-overlimit {
    background: repeating-linear-gradient(
        45deg,
        var(--bad),
        var(--bad) 10px,
        #ffffff 10px,
        #ffffff 20px
    ) !important;
    color: #ffffff !important;
    border: 1px solid var(--bad) !important;
}

.btn-counter {
    background-color: var(--ok) !important;
    color: #ffffff !important;
}

.btn-limit {
    background-color: var(--bad) !important;
    color: #ffffff !important;
}

/* Unified status block for completed habits */
.habit-status-block {
    width: 100%;
    padding: 9px 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    color: #ffffff;
    border: 2px solid;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.habit-status-block.status-block-success {
    background: var(--ok);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.3) 4px,
        rgba(255, 255, 255, 0.3) 8px
    );
    border-color: var(--ok);
    padding: 6.75px 16px;
}

.habit-status-block.status-block-failure {
    background: var(--bad);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.3) 4px,
        rgba(255, 255, 255, 0.3) 8px
    );
    border-color: var(--bad);
}

.habit-status-block.status-block-info {
    background: #ffffff;
    color: #333333;
    border-color: #dddddd;
    text-shadow: none;
}

/* Counter Progress Buttons */
.btn-counter-progress, .btn-limit-progress {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid #cccccc;
    color: #333333;
    min-height: 50px;
}

.counter-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress);
    background: var(--ok);
    transition: width 0.3s ease;
    z-index: 1;
}

.limit-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress);
    background: var(--ok);
    transition: width 0.3s ease;
    z-index: 1;
}

.counter-progress-segments, .limit-progress-segments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.counter-progress-segments::before, .limit-progress-segments::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent calc(100% / var(--target) - 1px),
        #cccccc calc(100% / var(--target) - 1px),
        #cccccc calc(100% / var(--target))
    );
}

.counter-label, .limit-label {
    position: relative;
    z-index: 3;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.btn-limit-progress.over-limit {
    background: #ffcccc;
    border-color: var(--bad);
}

.btn-limit-progress.over-limit .limit-progress-fill {
    background: var(--bad);
}

.btn-limit-progress.at-limit {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.btn-limit-progress.at-limit .limit-progress-fill {
    background: #ffc107;
}

/* Limit Zero Button - "Nicht getan" Button (Aktives Check-in System) */
.btn-limit-zero {
    background: linear-gradient(135deg, var(--ok) 0%, #15803d 100%);
    color: white;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--ok);
    transition: all 0.2s ease;
}

.btn-limit-zero:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-limit-zero:active {
    transform: scale(0.98);
}

/* Mutual Exclusivity - Disabled States für Limit-Buttons */
.btn-limit-zero.disabled,
.btn-limit-progress.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(50%);
}


/* Icon Picker Styles */
.icon-picker-container {
    position: relative;
    margin: 8px 0;
    width: fit-content;
}

.icon-preview-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg);
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 60px;
    height: 50px;
    box-sizing: border-box;
}

.icon-preview-compact:hover {
    background-color: #f8f9fa;
}

.icon-preview-svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    filter: none;
}

.icon-preview-compact .dropdown-arrow {
    font-size: 12px;
    color: var(--muted);
    position: absolute;
    bottom: 2px;
    right: 4px;
}

.dropdown-arrow {
    font-size: 14px;
    color: var(--muted);
    flex-shrink: 0;
}

.icon-grid {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #f8f9fa;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 12px;
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 4px;
    background-color: var(--bg);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    aspect-ratio: 1;
}

.icon-option:hover {
    background-color: var(--fg);
    border-color: var(--fg);
    transform: scale(1.05);
}

.icon-svg {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: none;
}

.icon-option:hover .icon-svg {
    filter: brightness(0) invert(1);
}

.icon-category-section {
    margin-bottom: 20px;
}

.icon-category-section:last-child {
    margin-bottom: 0;
}

.icon-category-header {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
}

.icon-category-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

@media (max-width: 600px) {
    .icon-category-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }

    .icon-option {
        padding: 8px;
    }

    .icon-svg {
        width: 20px;
        height: 20px;
    }

    .icon-category-header {
        font-size: 13px;
    }
}

/* Deleted Habit Icon - Diagonal Strikethrough */
.habit-icon-deleted {
    position: relative;
    display: inline-block;
}

.habit-icon-deleted::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom right,
        transparent calc(50% - 1.5px),
        var(--bad) calc(50% - 1.5px),
        var(--bad) calc(50% + 1.5px),
        transparent calc(50% + 1.5px)
    );
    pointer-events: none;
    z-index: 10;
}

/* Statistics Modal Styles */

/* Habit Stats Modal - Glass Effect */
#habit-stats-modal .modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Modal Title with Glass Header Style */
#habit-stats-modal h2 {
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: left;
}

/* Stat Box with Glass Effect */
#habit-stats-modal .stat-box {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Default stat-box for other uses */
.stat-box {
    background-color: var(--bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Stat Label - Smaller for Modal */
#habit-stats-modal .stat-label {
    font-size: 0.65rem;
    color: #FFFFFF;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 0.85rem;
    color: #000000;
    font-weight: 600;
    margin-bottom: 0px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stat Value - Smaller for Modal */
#habit-stats-modal .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2rem; /* Größere Zahlen */
    font-weight: 800; /* Gleiche Stärke */
    color: #000000; /* Schwarze Farbe */
}

/* Deleted Info Box with Glass Effect */
#habit-stats-modal #stat-deleted-info {
    background: rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px;
    border-left: 4px solid rgba(239, 68, 68, 0.8);
    margin-bottom: 16px;
}

#habit-stats-modal #stat-deleted-info strong,
#habit-stats-modal #stat-deleted-info span {
    color: #FFFFFF;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Close Button Styling */
#habit-stats-modal .btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#habit-stats-modal .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    #habit-stats-modal .modal-content {
        padding: 20px;
        border-radius: 20px;
    }

    #habit-stats-modal h2 {
        font-size: 1.25rem;
    }

    #habit-stats-modal .stat-value {
        font-size: 1.25rem;
    }
}

/* ============================================================================
   STATISTICS CARD STYLES
   ============================================================================ */

/* Header (Global Metrics) */
.statistics-header {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.statistics-header-metric {
    text-align: center;
}

.statistics-header-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statistics-header-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--fg);
    cursor: help;
}

.streak-update-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

/* Title Countdown - Monochrom and left-aligned */
.statistics-title-countdown {
    color: var(--fg);
    padding: 0;
    border-radius: 0;
    font-size: 1.5rem;
    font-weight: 900;
    text-align: left;
    letter-spacing: 0;
    white-space: nowrap;
    animation: pulse-countdown-mono 2s ease-in-out infinite;
}

@keyframes pulse-countdown-mono {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@media (max-width: 600px) {
    .statistics-title-countdown {
        font-size: 1.2rem;
    }
}

/* Table Container */
.statistics-table-container {
    margin-bottom: 32px;
    overflow-x: auto;
}

.statistics-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg);
}

.statistics-table thead {
    background-color: #f8f9fa;
}

.statistics-table th {
    padding: 12px 16px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--fg);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statistics-table th:first-child {
    text-align: left;
    width: 120px;
}

.statistics-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.statistics-table tbody tr:hover {
    background-color: #f8f9fa;
}

.statistics-table tbody tr:last-child {
    border-bottom: none;
}

.statistics-table td {
    padding: 14px 16px;
    text-align: center;
    font-size: 0.95rem;
}

.statistics-table td:first-child {
    text-align: left;
    font-weight: 700;
    color: var(--fg);
}

.statistics-table td .subvalue {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
    margin-left: 4px;
}

/* Sections */
.statistics-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.statistics-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.statistics-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--fg);
}

/* Weekday Performance */
.statistics-weekday-info-notice {
    background-color: #fef3c7;
    color: #92400e;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.statistics-weekday-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.statistics-weekday-bar-wrapper {
    display: grid;
    grid-template-columns: 40px 1fr 60px;
    align-items: center;
    gap: 12px;
}

.statistics-weekday-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--fg);
    text-align: left;
}

.statistics-weekday-bar {
    height: 24px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.statistics-weekday-bar.best {
    border-color: var(--ok);
}

.statistics-weekday-bar.worst {
    border-color: #f59e0b;
}

.statistics-weekday-fill {
    height: 100%;
    background-color: var(--ok);
    transition: width 0.3s ease;
}

.statistics-weekday-percent {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--fg);
    text-align: right;
}

.statistics-weekday-summary {
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
    margin-top: 12px;
    font-weight: 600;
}


/* Perfect Days - Color-coded */
.perfect-days-green {
    color: var(--ok);
    font-weight: 700;
}

.perfect-days-yellow {
    color: #f59e0b;
    font-weight: 700;
}

.perfect-days-gray {
    color: var(--muted);
    font-weight: 700;
}

/* Trend Arrows */
.trend-up {
    color: var(--ok);
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 6px;
}

.trend-down {
    color: var(--bad);
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 6px;
}

/* Missed Chip */
.missed-chip {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 600;
}

/* Low Data Badge */
.low-data-badge {
    display: inline-block;
    background-color: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: help;
}

/* Responsive */
@media (max-width: 900px) {
    .statistics-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .statistics-header {
        grid-template-columns: 1fr;
    }

    .statistics-header-value {
        font-size: 1.2rem;
    }

    .statistics-kpi-grid {
        grid-template-columns: 1fr;
    }

    .statistics-kpi-value {
        font-size: 1.5rem;
    }

    .statistics-weekday-bar-wrapper {
        grid-template-columns: 35px 1fr 50px;
        gap: 8px;
    }

    .statistics-weekday-label {
        font-size: 0.8rem;
    }

    .statistics-weekday-percent {
        font-size: 0.8rem;
    }
}

/* ============================================
   REVIEW SECTION (TABS: ACHIEVEMENTS + HISTORY)
   ============================================ */

/* Review Header */
.review-header {
    margin-bottom: 20px;
}

/* Tab Navigation - Glasoptik (analog zu Analytics) */
.review-tabs {
    display: flex;
    gap: 0; /* Kein Gap für Slider */
    padding: 4px;
    /* Papierlook mit Neumorphismus */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    margin-bottom: 20px;
    position: relative;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y; /* Allow vertical scrolling but capture horizontal */
    /* Papier-Schatten: leicht erhaben */
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.review-tabs:active {
    cursor: grabbing;
}

/* Slider Pill (bewegt sich) */
.review-tabs::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    /* Weißer Papier-Button der über dem Papier schwebt */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    /* Schwebender Schatten - Neumorphismus */
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* Pill Position wenn Museum aktiv */
.review-tabs.museum-active::before {
    transform: translateX(calc(100% + 4px));
}

/* Individual Tab Button */
.review-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.55) !important; /* Schwarz/Grau für Lesbarkeit auf Papier */
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.review-tab:hover {
    color: rgba(0, 0, 0, 0.75) !important; /* Dunkler beim Hover */
}

.review-tab.active {
    color: rgba(0, 0, 0, 0.9) !important; /* Tiefes Schwarz für aktiven Tab */
    font-weight: 700;
}

/* Spans innerhalb der Review-Tabs auch schwarz */
.review-tab span {
    color: inherit !important;
    text-shadow: none !important;
}

/* Tab Content Panels */
.review-tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

.review-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   PROGRESS SECTION (TABS: STADTFEST + KALENDER)
   ============================================ */

/* Progress Header */
.progress-header {
    margin-bottom: 20px;
}

/* Tab Navigation */
.progress-tabs {
    display: flex;
    gap: 0;
    padding: 4px;
    /* Papierlook mit Neumorphismus */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    margin-bottom: 25px;
    position: relative;
    /* Papier-Schatten: leicht erhaben */
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Slider Pill (bewegt sich zwischen den Tabs) */
.progress-tabs::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(33.333% - 4px); /* 3 Tabs = 33.333% Breite */
    height: calc(100% - 8px);
    /* Weißer Papier-Button der über dem Papier schwebt */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    /* Schwebender Schatten - Neumorphismus */
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* Pill Positionen für jeden Tab */
.progress-tabs.tab-overview::before { transform: translateX(0); }
.progress-tabs.tab-habits::before { transform: translateX(calc(100% + 4px)); }
.progress-tabs.tab-history::before { transform: translateX(calc(200% + 8px)); }

/* Individual Tab Button */
.progress-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.55); /* Schwarz/Grau für Lesbarkeit auf Papier */
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
    text-align: center;
}

.progress-tab:hover {
    color: rgba(0, 0, 0, 0.75); /* Dunkler beim Hover */
}

.progress-tab.active {
    color: rgba(0, 0, 0, 0.9); /* Tiefes Schwarz für aktiven Tab */
    font-weight: 700;
}

/* Tab Content Panels */
.progress-tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
    position: relative; /* Für absolute Positionierung von Kind-Elementen */
}

.progress-tab-content.active {
    display: block;
}

/* ============================================
   HISTORY PANEL STYLES
   ============================================ */

/* History Tags Container */
.history-tags-container {
    margin-bottom: 30px;
}

.history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

/* Individual Tag */
.history-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--bg);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fg);
    user-select: none;
}

.history-tag:hover {
    border-color: var(--muted);
    background-color: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.history-tag.selected {
    background-color: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

.history-tag.selected:hover {
    background-color: #374151;
    border-color: #374151;
}

.history-tag.deleted {
    opacity: 0.6;
}

.history-tag.deleted .history-tag-name {
    text-decoration: line-through;
}

.history-tag img {
    filter: grayscale(0);
    transition: filter 0.2s ease;
}

.history-tag:not(.selected) img {
    filter: grayscale(60%);
}

/* History Reports Container */
.history-reports-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.history-empty-reports {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 1rem;
    grid-column: 1 / -1;
}

/* Report Card */
.history-report-card {
    background-color: var(--bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.history-report-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Report Header */
.history-report-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.history-report-title {
    flex: 1;
}

.history-report-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg);
}

.history-report-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.history-report-status.active {
    background-color: #dcfce7;
    color: #166534;
}

.history-report-status.deleted {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* Report Body */
.history-report-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-report-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.history-report-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.history-report-value {
    font-size: 0.9rem;
    color: var(--fg);
    font-weight: 600;
    text-align: right;
}

/* Pagination */
.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

#history-page-info {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    min-width: 120px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .history-reports-container {
        grid-template-columns: 1fr;
    }

    .history-tag {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .history-report-card {
        padding: 16px;
    }

    .history-report-header {
        flex-direction: row;
        align-items: flex-start;
    }
}

/* ==================== MOBILE BOTTOM NAVIGATION ==================== */

/* Hide Bottom Nav on Desktop */
.bottom-nav {
    display: none;
}

/* Hide footer on mobile (links are in hamburger menu) */
@media (max-width: 768px) {
    .page-footer {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        /* Komplett transparent - für ALLE Tabs */
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 0;
        padding: 6px 4px; /* Kompakter: 12px → 6px */
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: none !important;
        /* iOS Safari Fix - verhindert weißen Hintergrund */
        -webkit-appearance: none;
        isolation: isolate;
    }

    /* Slide-Pill (bewegt sich hinter aktivem Tab) */
    .bottom-nav::before {
        content: '';
        position: absolute;
        top: 3px;
        left: 9px;
        width: calc(25% - 3px); /* 4 Tabs = 25% Breite */
        height: calc(100% - 6px);
        /* Komplett transparent */
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 12px;
        box-shadow: none !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 0;
    }

    /* Pill Positionen für jeden Tab */
    .bottom-nav.tab-0::before { transform: translateX(-7px); } /* -7px für left: 2px */
    .bottom-nav.tab-1::before { transform: translateX(calc(100% - 9px)); } /* -9px für left: 0px */
    .bottom-nav.tab-2::before { transform: translateX(calc(200% - 14px)); } /* -14px für left: -5px */
    .bottom-nav.tab-3::before { transform: translateX(calc(300% - 9px)); } /* -9px für bessere Zentrierung */

    .bottom-nav-item {
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
        justify-content: center;
        /* Subtiler Milchglas-Hintergrund für jeden Button */
        background: rgba(255, 255, 255, 0.15) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
        padding: 6px 8px; /* Kompakter: 10px → 6px */
        cursor: pointer;
        transition: all 0.3s ease;
        color: rgba(0, 0, 0, 0.55); /* Schwarz/Grau für Lesbarkeit auf Papier */
        flex: 1;
        max-width: 80px;
        position: relative;
        z-index: 1;
        gap: 4px; /* Kompakter: 6px → 4px */
        /* iOS Safari Fix */
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item.active {
        color: rgba(0, 0, 0, 0.9); /* Tiefes Schwarz für aktiven Tab */
        font-weight: 700;
        /* Aktiver Button leicht stärker */
        background: rgba(255, 255, 255, 0.25) !important;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), 0 3px 8px rgba(0, 0, 0, 0.2);
    }

    .bottom-nav-icon {
        width: 24px; /* Kompakt: 28px → 24px */
        height: 24px;
        transition: transform 0.2s ease, filter 0.2s ease;
        /* Grau für inaktive Icons */
        filter: brightness(0) saturate(100%) opacity(0.55);
    }

    /* Pixelart Icons - special rendering */
    .bottom-nav-icon-pixelart {
        width: 40px; /* Größer für Pixelart-Details */
        height: 40px;
        image-rendering: pixelated; /* Pixel-perfect rendering */
        image-rendering: -moz-crisp-edges;
        image-rendering: crisp-edges;
        filter: var(--nav-icon-shadow-inactive); /* Schatten für inaktive Icons */
        opacity: 0.7; /* Inaktiv leicht transparent */
        transform: translateY(-5px); /* Icons 5px nach oben verschieben */
        /* Bounce-Effekt: Icon schießt über Ziel hinaus und bounct zurück */
        transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                    opacity 0.3s ease,
                    filter 0.3s ease;
    }

    /* Icon Bounce beim Aktivieren */
    .bottom-nav-item.active .bottom-nav-icon {
        transform: scale(1.05); /* Subtiler: 1.1 → 1.05 */
        /* Tiefes Schwarz für aktives Icon */
        filter: brightness(0) saturate(100%) opacity(0.9);
    }

    /* Einzelne Position-Offsets für jeden Tab */
    .bottom-nav-item[data-tab="habitcheck"].active .bottom-nav-icon-pixelart {
        transform: scale(1.85) translateY(calc(var(--nav-icon-offset-habits) - 8px));
        opacity: 1;
        filter: var(--nav-icon-shadow-active);
    }

    .bottom-nav-item[data-tab="stadtfest"].active .bottom-nav-icon-pixelart {
        transform: scale(1.85) translateY(calc(var(--nav-icon-offset-stadtfest) - 8px));
        opacity: 1;
        filter: var(--nav-icon-shadow-active);
    }

    .bottom-nav-item[data-tab="analytics"].active .bottom-nav-icon-pixelart {
        transform: scale(1.85) translateY(calc(var(--nav-icon-offset-analytics) - 8px));
        opacity: 1;
        filter: var(--nav-icon-shadow-active);
    }

    .bottom-nav-item[data-tab="rueckblicke"].active .bottom-nav-icon-pixelart {
        transform: scale(1.85) translateY(calc(var(--nav-icon-offset-erfolge) - 8px));
        opacity: 1;
        filter: var(--nav-icon-shadow-active);
    }

    .bottom-nav-label {
        font-size: 0.7rem; /* Kleiner: 0.75rem → 0.7rem */
        font-weight: 600;
        text-align: center;
        line-height: 1.1;
        transition: opacity 0.2s ease;
    }

    /* Text ausblenden für aktiven Tab (nur bei Pixelart-Icons) */
    .bottom-nav-item.active:has(.bottom-nav-icon-pixelart) .bottom-nav-label {
        opacity: 0;
    }

    /* Add padding to bottom of content to prevent overlap with bottom nav */
    .container {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    /* On mobile: hide all main sections by default - switchMobileTab() will show the active one */
    #setup,
    #simulate-section,
    #checkin,
    #focus,
    #progress-card,
    #statistics-card,
    #review-card,
    #danger {
        display: none;
    }
}

/* ==================== HAMBURGER MENU ==================== */

/* Default: Hide hamburger button (will be shown in media queries) */
.hamburger-btn {
    display: none;
}

/* Hide Hamburger Menu Overlay by default */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    animation: fadeIn 0.2s ease;
}

.hamburger-menu.active {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hamburger-menu-header {
    background: #FFFFFF; /* White background */
    width: 80%;
    max-width: 300px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E5E7EB;
    animation: slideInLeft 0.3s ease;
    box-shadow: none; /* No shadow */
}

.hamburger-menu-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #1F2937; /* Dark text on white */
}

.hamburger-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger-close svg {
    width: 20px;
    height: 20px;
    stroke: #1F2937; /* Dark icon on white */
}

.hamburger-menu-content {
    background: #FFFFFF; /* White background */
    width: 80%;
    max-width: 300px;
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
    animation: slideInLeft 0.3s ease;
    box-shadow: none; /* No shadow */
}

.hamburger-menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    background: none;
    border: none;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 1rem;
    color: #1F2937; /* Dark text on white */
    text-align: left;
    text-decoration: none;
}

.hamburger-menu-item:hover,
.hamburger-menu-item:active {
    background: #F3F4F6; /* Light gray on hover */
}

.hamburger-menu-item svg {
    width: 22px;
    height: 22px;
    stroke: #1F2937; /* Dark icons */
    flex-shrink: 0;
}
    height: 22px;
    stroke: currentColor;
    flex-shrink: 0;
}

.hamburger-menu-item.danger {
    color: var(--bad);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        position: fixed;
        top: 10px;
        left: 0; /* Align with container left edge */
        width: 44px;
        height: 44px;
        background: transparent; /* No background */
        border: none; /* No border */
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1001;
        box-shadow: none; /* No shadow */
        transition: all 0.2s ease;
    }

    .hamburger-btn:active {
        transform: scale(0.95);
    }

    .hamburger-btn svg {
        width: 24px;
        height: 24px;
        stroke: #FFFFFF; /* White lines */
    }

    .hamburger-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1002;
        animation: fadeIn 0.2s ease;
    }

    .hamburger-menu.active {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .hamburger-menu-header {
        background: var(--bg);
        width: 80%;
        max-width: 300px;
        padding: 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border-color);
        animation: slideInLeft 0.3s ease;
    }

    .hamburger-menu-header h3 {
        margin: 0;
        font-size: 1.2rem;
        color: var(--fg);
    }

    .hamburger-close {
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
    }

    .hamburger-close svg {
        width: 20px;
        height: 20px;
        stroke: var(--fg);
    }

    .hamburger-menu-content {
        background: var(--bg);
        width: 80%;
        max-width: 300px;
        flex: 1;
        padding: 10px 0;
        overflow-y: auto;
        animation: slideInLeft 0.3s ease;
    }

    .hamburger-menu-item {
        display: flex;
        align-items: center;
        gap: 16px;
        width: 100%;
        background: none;
        border: none;
        padding: 16px 20px;
        cursor: pointer;
        transition: background 0.2s ease;
        font-size: 1rem;
        color: var(--fg);
        text-align: left;
    }

    .hamburger-menu-item:hover,
    .hamburger-menu-item:active {
        background: var(--border-color);
    }

    .hamburger-menu-item svg {
        width: 22px;
        height: 22px;
        stroke: currentColor;
        flex-shrink: 0;
    }

    .hamburger-menu-item.danger {
        color: var(--bad);
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    @keyframes slideInLeft {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0);
        }
    }
}

/* ========================================
   TUTORIAL SYSTEM
   ======================================== */

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.tutorial-container {
    width: 100%;
    max-width: 800px;
    background: var(--bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.tutorial-step {
    display: none;
    animation: tutorialFadeIn 0.4s ease;
}

.tutorial-step.active {
    display: block !important;
}

@keyframes tutorialFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tutorial-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}

.tutorial-header h1 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--fg);
    margin: 0 0 10px 0;
}

.tutorial-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--fg);
    margin: 0;
}

.tutorial-header p {
    color: var(--muted);
    font-size: 1rem;
    margin: 10px 0 0 0;
}

.tutorial-content {
    margin: 30px 0;
    min-height: 250px;
}

.tutorial-text {
    color: var(--fg);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 20px;
}

.tutorial-text strong {
    font-weight: 700;
    color: var(--fg);
}

/* Half Progress Ring (0-40) */
.progress-ring-demo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
}

.progress-ring-half {
    position: relative;
    width: 200px;
    height: 120px;
    overflow: hidden;
}

.progress-ring-half svg {
    width: 200px;
    height: 200px;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
    fill: transparent;
    stroke-linecap: round;
    stroke-width: 14;
}

.progress-ring-bg {
    stroke: var(--miss);
    stroke-width: 14;
    fill: transparent;
}

.progress-ring-text {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 900;
    font-size: 2.5rem;
    color: var(--fg);
    text-align: center;
}

.progress-ring-label {
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 5px;
    font-weight: 700;
}

/* Points Display */
.points-demo {
    text-align: center;
    margin: 40px 0;
}

.points-value {
    font-size: 4rem;
    font-weight: 900;
    margin: 20px 0;
    animation: pointsPop 0.6s ease;
}

.points-value.positive {
    color: var(--ok);
}

.points-value.negative {
    color: var(--bad);
}

.points-value.neutral {
    color: var(--muted);
}

@keyframes pointsPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.points-explanation {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 600;
}

/* Habit Examples */
.habit-examples {
    display: grid;
    gap: 15px;
    margin: 30px 0;
}

.habit-example {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: var(--bg);
}

.habit-example h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--fg);
}

.habit-example p {
    margin: 5px 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.habit-example .example-visual {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
}

/* Presets Grid */
.presets-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 30px 0;
}

.preset-item {
    background: var(--muted);
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
}

.preset-item strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 5px;
}

.preset-item small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Playground Images */
.playground-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 30px 0;
}

.playground-image-item {
    text-align: center;
}

.playground-image-item img {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    aspect-ratio: 1;
    object-fit: cover;
}

.playground-image-item p {
    margin: 10px 0 0 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
}

/* Calendar Demo */
.calendar-demo {
    margin: 30px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.weekday {
    font-weight: 700;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding-bottom: 10px;
}

.calendar-day {
    min-height: 70px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    background: var(--bg);
}

.day-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--fg);
    padding: 2px;
}

.day-segments {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px;
    height: auto;
    margin-top: auto;
}

.seg {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seg img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.legend-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* Achievements */
.achievements-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.achievement-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: var(--bg);
}

.achievement-medal {
    font-size: 3rem;
    margin-bottom: 10px;
}

.achievement-item h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: var(--fg);
}

.achievement-item p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Tutorial Navigation */
.tutorial-navigation {
    display: flex;
    gap: 12px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.tutorial-navigation .btn {
    flex: 1;
    font-weight: 900;
    font-size: 1.5rem;
    line-height: 1;
}

/* Progress Indicator */
.progress-indicator {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s ease;
}

.progress-dot.active {
    background: var(--fg);
    transform: scale(1.5);
}

/* Info Box */
.info-box {
    background: #f8f9fa;
    border-left: 4px solid var(--fg);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.info-box p {
    margin: 0;
    color: var(--fg);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Metric Card Demo */
.metric-card-demo {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    background-color: var(--bg);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    margin: 30px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .tutorial-container {
        padding: 30px 20px;
    }

    .tutorial-header h1 {
        font-size: 1.5rem;
    }

    .tutorial-header h2 {
        font-size: 1.2rem;
    }

    .playground-images {
        grid-template-columns: 1fr;
    }

    .points-value {
        font-size: 3rem;
    }

    .metric-card-demo {
        flex-direction: column;
        padding: 24px;
    }

    .tutorial-navigation {
        flex-wrap: wrap;
    }

    .tutorial-navigation .btn {
        min-width: 100px;
    }
}

/* =======================================
   ANIMATION: ENERGY FLOW CARD
   ======================================== */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes energy-flow {
  to {
    --angle: 360deg;
  }
}

/* =======================================
   REFINED POWER GAUGE
   ======================================== */

.gauge-progress-path {
    /* The glow color will be the same as the stroke color */
    filter: drop-shadow(0 2px 4px var(--glow-color));
    transition: stroke-dashoffset 0.8s cubic-bezier(0.65, 0, 0.35, 1), 
                stroke 0.5s ease, 
                filter 0.5s ease;
}

.gauge-notch {
    transition: fill 0.4s ease;
}

.gauge-notch.active {
    fill: var(--glow-color);
}

/* Class for the animated counter text */
.gauge-value-animating {
    transition: none; /* Disable transition during fast counting */
}

/* =======================================
   PULSING BUTTON ANIMATION
   ======================================== */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    }
}

/* Dezenter Blink alle paar Sekunden für pending Buttons */
@keyframes subtle-blink {
    0%, 90%, 100% {
        opacity: 1;
    }
    95% {
        opacity: 0.6;
    }
}

.pulse-alternate-1 {
    animation: none;
}

.pulse-alternate-2 {
    animation: none;
}


/* Animation for when a streak increases */
@keyframes streakUp {
    0% {
        transform: scale(1);
        text-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.4);
        text-shadow: 0 0 16px rgba(255, 255, 255, 1);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    }
}

.streak-up-animation {
    animation: streakUp 0.6s ease-in-out;
}

/* Animation for when a streak drops to zero */
@keyframes streakZero {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
    0%, 50%, 100% {
        box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    }
    25%, 75% {
        box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.7);
    }
}

.streak-zero-animation {
    animation: streakZero 0.8s cubic-bezier(.36,.07,.19,.97) both;
    border-color: var(--bad);
}

/* ============================================================================
   STATISTICS TAB SYSTEM
   ============================================================================ */

.statistics-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.statistics-tab {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.statistics-tab:hover {
    color: var(--fg);
    background: rgba(41, 110, 2, 0.05); /* Light green hover */
}

.statistics-tab.active {
    color: #296e02; /* Dark green (matching habit card palette) */
    border-bottom-color: #296e02;
}

.statistics-tab-content {
    display: none;
}

.statistics-tab-content.active {
    display: block;
}

/* ============================================================================
   CHART VISUALIZATION STYLES (New Statistics Chart View)
   ============================================================================ */

.statistics-chart-section {
    margin-bottom: 30px;
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: var(--fg);
}

.chart-average {
    font-size: 1rem;
    color: var(--muted);
}

#chart-average-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg);
}

.chart-date-range {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 15px;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 280px;
    margin-bottom: 20px;
    background: var(--bg);
}

/* Grid should have same height as chart to prevent layout shift */
.chart-365-grid {
    position: relative;
    min-height: 280px; /* Match chart height exactly */
    margin-bottom: 20px; /* Match chart margin */
    overflow-y: auto; /* Allow scrolling if needed */
}

.chart-period-toggles {
    display: flex;
    gap: 8px;
    justify-content: center;
    background: var(--bg-secondary, #f3f4f6);
    padding: 6px;
    border-radius: 24px;
    width: fit-content;
    margin: 20px auto 0 auto;
}

/* OLD STYLES REMOVED - Now using paper-look styles with #analytics-statistics-view selector */

/* 365 Days Grid View (GitHub-style) - additional styles */
.chart-365-grid {
    padding: 20px;
    background: var(--bg);
    border-radius: 8px;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.grid-days-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--fg);
}

.grid-date-range {
    font-size: 0.85rem;
    color: var(--muted);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); /* Many small columns, auto-layout */
    gap: 4px;
    padding: 12px 0;
    max-width: 100%;
}

.grid-day {
    width: 100%;
    aspect-ratio: 1; /* Keep circles */
    max-width: 14px; /* Small circles like 30D habit view */
    max-height: 14px;
    border-radius: 50%; /* CIRCLES not squares */
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.grid-day:hover {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Success rate colors for grid - using same green palette as habit cards */
.grid-day.rate-0 {
    background: var(--bad);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.grid-day.rate-25 {
    background: #b2f25b; /* Light green (like Streak 5) */
    box-shadow: 0 1px 3px rgba(178, 242, 91, 0.3);
}

.grid-day.rate-50 {
    background: #58b905; /* Medium green (like Streak 15) */
    box-shadow: 0 1px 3px rgba(88, 185, 5, 0.3);
}

.grid-day.rate-75 {
    background: #296e02; /* Dark green (like Streak 22) */
    box-shadow: 0 1px 3px rgba(41, 110, 2, 0.4);
}

.grid-day.rate-100 {
    background: #14532d; /* Very dark green (maximum, like Streak 30) */
    box-shadow: 0 2px 4px rgba(20, 83, 45, 0.5);
}

.grid-day.empty {
    background: transparent;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

/* Tooltip for grid day */
.grid-day-tooltip {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-day:hover .grid-day-tooltip {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chart-container {
        height: 220px;
    }

    .chart-title {
        font-size: 1.2rem;
    }

    .chart-period-toggles {
        gap: 4px;
        padding: 4px;
    }

    .chart-period-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
        min-width: 44px;
    }

    .grid-container {
        gap: 3px;
        grid-template-columns: repeat(auto-fill, minmax(12px, 1fr));
    }

    .grid-day {
        max-width: 12px; /* Smaller on mobile */
        max-height: 12px;
    }

    .chart-365-grid {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .chart-container {
        height: 180px;
    }

    .grid-day {
        max-width: 10px; /* Even smaller on small mobile */
        max-height: 10px;
    }

    .grid-container {
        gap: 2px;
        grid-template-columns: repeat(auto-fill, minmax(10px, 1fr));
    }
}

/* ============================================================================
   HABIT CARDS (Tab 2 & 3)
   ============================================================================ */

#habits-cards-container,
#history-cards-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.habit-card {
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.habit-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.habit-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.habit-card-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    background: rgba(41, 110, 2, 0.1); /* Light green background */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.habit-card-icon img,
.habit-card-icon svg {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    opacity: 0.9;
    display: block;
    object-fit: contain;
}

.habit-card-icon svg {
    color: #296e02; /* Dark green (matching habit card palette) */
}

.habit-card-info {
    flex: 1;
}

.habit-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg);
    margin: 0 0 4px 0;
}

.habit-card-stats {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.habit-card-stat {
    display: inline-block;
}

.habit-card-toggle {
    display: flex;
    gap: 0; /* No gap for slider */
    /* Papierlook mit Neumorphismus */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 4px;
    border-radius: 16px;
    margin-top: 16px;
    /* justify-content removed - buttons should fill full width with flex: 1 */
    position: relative;
    /* Papier-Schatten: leicht erhaben */
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Weißer Schieberegler für Habit Card Toggle (5 Buttons) - JavaScript-gesteuert */
/* EXAKT wie Chart-Period-Toggles (funktioniert dort perfekt) */
.habit-card-toggle::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 0px; /* Test: Startpunkt bei 0 */
    width: calc(10% + 4px); /* +2px größer */
    height: calc(100% - 8px);
    /* Weißer Papier-Button der über dem Papier schwebt */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    /* Schwebender Schatten - Neumorphismus */
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
    /* Position wird via JavaScript gesetzt (--pill-offset) */
    transform: translateX(var(--pill-offset, 0px));
}

.habit-card-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.55) !important; /* Schwarz/Grau für Lesbarkeit auf Papier */
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.habit-card-toggle-btn:hover {
    color: rgba(0, 0, 0, 0.75) !important; /* Dunkler beim Hover */
}

.habit-card-toggle-btn.active {
    color: rgba(0, 0, 0, 0.9) !important; /* Tiefes Schwarz für aktiven Button */
    font-weight: 700;
}

.habit-card-toggle-btn svg {
    fill: currentColor; /* SVG nutzt Button-Textfarbe */
}

.habit-card-toggle-btn svg * {
    fill: currentColor !important; /* Alle SVG-Elemente schwarz */
}

/* Exception: Habit-Card-Toggle SVGs sollen NICHT weiß sein (überschreibt Zeile 807) */
#analytics-statistics-view .habit-card-toggle-btn svg {
    filter: brightness(0) !important; /* Nur schwarz, KEIN invert */
    opacity: 1 !important;
}

.habit-card-delete-btn {
    background: transparent;
    border: none;
    padding: 8px;
    margin-left: 8px;
    border-radius: 8px;
    color: var(--danger, #ef4444);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.habit-card-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.habit-card-delete-btn svg {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.habit-card-viz {
    margin-top: 16px;
    min-height: 180px;
}

/* 7D Bars Visualization */
.habit-7d-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 180px;
    gap: 8px;
    padding: 0 12px;
}

.habit-7d-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.habit-7d-bar {
    width: 100%;
    background: var(--miss);
    border-radius: 6px 6px 0 0;
    transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    position: relative;
    min-height: 8px;
    height: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.habit-7d-bar.success {
    background: linear-gradient(to top, #16a34a, #22c55e);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.habit-7d-bar.failed {
    background: linear-gradient(to top, #dc2626, #ef4444);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.habit-7d-bar.empty {
    background: transparent;
    border: 1px dashed var(--border-color);
    box-shadow: none;
    min-height: 0;
}

.habit-7d-bar-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}

/* 30D Grid Visualization */
.habit-30d-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 12px;
    max-width: 280px;
    margin: 0 auto;
}

.habit-30d-dot {
    width: 100%;
    max-width: 28px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--miss);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.habit-30d-dot.animate {
    opacity: 1;
    transform: scale(1);
}

.habit-30d-dot.success {
    background: #22c55e;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
}

.habit-30d-dot.failed {
    background: var(--bad);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.habit-30d-dot.empty {
    background: transparent;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

/* 365D Grid Visualization for Habit Cards */
.habit-365-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10px, 1fr));
    gap: 3px;
    padding: 12px 0;
    max-width: 100%;
    max-height: 180px;
    overflow-y: auto;
}

.habit-365-dot {
    width: 100%;
    aspect-ratio: 1;
    max-width: 10px;
    max-height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.habit-365-dot.success {
    background: #22c55e;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.4);
}

.habit-365-dot.failed {
    background: var(--bad);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.habit-365-dot.missed {
    background: var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 2px solid #000;
}

.habit-365-dot.empty {
    background: var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.habit-365-dot:hover {
    transform: scale(1.3);
    z-index: 10;
}

/* Animations */
@keyframes barGrowUp {
    from {
        height: 0;
    }
    to {
        height: var(--bar-height);
    }
}

@keyframes dotPopIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Keep horizontal layout on tablets */
    .habit-card-toggle {
        /* flex-wrap removed - buttons should stay in one line with flex: 1 */
    }

    .habit-card-toggle-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .habit-7d-bars {
        gap: 4px;
        padding: 0 8px;
        height: 150px;
    }

    .habit-30d-grid {
        gap: 4px;
        max-width: 240px;
    }

    .habit-30d-dot {
        max-width: 24px;
    }

    .habit-card-viz {
        min-height: 150px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .habit-365-grid {
        max-width: 100%;
        overflow-x: hidden;
    }
}

@media (max-width: 600px) {
    /* Use full width on mobile */
    .container {
        padding: 8px 8px calc(80px + env(safe-area-inset-bottom)) 8px;
    }

    .card {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 8px;
    }

    /* Keep habit card header horizontal and compact */
    .habit-card-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
    }

    .habit-card-header .habit-name-header {
        flex: 1;
        font-size: 0.95rem;
    }

    .habit-card-header button {
        flex-shrink: 0;
        padding: 6px;
        margin-left: 0;
    }

    /* Ensure edit and delete buttons stay on the right */
    .habit-card-header button:first-of-type {
        margin-left: auto;
    }

    .habit-card-header img {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }

    /* Compact metric displays */
    .current-streak-number {
        font-size: 48px;
    }

    .cell-streak {
        font-size: 36px;
    }

    .metric-label {
        font-size: 0.7rem;
    }

    .habit-card-toggle {
        flex-wrap: wrap;
        gap: 4px;
        width: 100%;
        justify-content: center;
    }

    .habit-card-toggle-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
        flex: 0 0 auto;
    }

    .habit-card-viz {
        overflow-x: hidden;
    }

    .chart-container,
    .chart-365-grid {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Make statistics header compact like in image 51.jpg */
    .statistics-header {
        max-width: 100%;
        overflow-x: hidden;
        gap: 6px;
        grid-template-columns: repeat(3, 1fr);
        padding: 8px 0;
        margin-bottom: 16px;
        background: transparent;
        border: none;
    }

    .statistics-header-metric {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }

    .statistics-header-label {
        font-size: 0.6rem;
        text-align: center;
        line-height: 1.1;
        margin-bottom: 2px;
    }

    .statistics-header-value {
        font-size: 1.3rem;
        font-weight: 700;
        text-align: center;
    }

    /* Hide "Tage" text on mobile to save space */
    .statistics-header-value .days-label {
        display: none;
    }

    .habit-card-stats {
        flex-wrap: wrap;
        font-size: 0.75rem;
        gap: 8px;
    }

    /* Statistics tabs - make them smaller and fit */
    .statistics-tabs {
        gap: 4px;
        justify-content: space-between;
        margin-bottom: 16px;
    }

    .statistics-tab {
        padding: 10px 8px;
        font-size: 0.8rem;
        flex: 1;
        min-width: 0;
    }

    /* Note: Label translation handled by i18n.js via data-translate-key */
    /* Removed hardcoded ::after content for proper i18n support */

    /* Streak Row - Keep Streak and Best in one row on mobile */
    .streak-row {
        flex-wrap: nowrap;
        gap: 8px;
        align-items: center;
    }

    .streak-label {
        flex-shrink: 0;
        font-size: 10px;
        white-space: nowrap;
    }

    .pill {
        flex-shrink: 0;
        padding: 3px 10px;
        font-size: 11px;
    }
}

/* ==========================================
   SPLASH SCREEN (Loading Screen)
   ========================================== */

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    z-index: 99999;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.5s ease-out;
}

#splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Splash Image - Fullscreen Cover */
.splash-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Loader Container - positioned below the "powerhabit" text */
.splash-loader-container {
    position: absolute;
    bottom: 61%; /* Optimale Position unter "POWERHABIT" */
    left: 50%;
    transform: translateX(-50%);
    width: 72%; /* Exakte Breite passend zur "POWERHABIT" Typografie */
    max-width: 600px;
    z-index: 2;
}

/* Pixelart Loader Background (empty bar) */
.splash-loader-bg {
    width: 100%;
    height: 16px; /* Pixelart style - chunky height */
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 0; /* No border-radius for pixelart */
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    image-rendering: pixelated; /* Pixelart style */
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Pixelart Loader Fill (animated progress) */
.splash-loader-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%; /* Starts at 0, will be animated via JS */
    background: linear-gradient(90deg,
        #80e908 0%,
        #a0ff20 50%,
        #80e908 100%
    );
    transition: width 0.3s ease-out;
    box-shadow:
        0 0 10px rgba(128, 233, 8, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Pixelart style segments (optional visual enhancement) */
.splash-loader-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 8px,
        rgba(0, 0, 0, 0.1) 8px,
        rgba(0, 0, 0, 0.1) 10px
    );
}

/* Mobile optimization */
@media (max-width: 768px) {
    .splash-loader-container {
        width: 70%;
        bottom: 61%; /* Optimale Position unter "POWERHABIT" */
    }

    .splash-loader-bg {
        height: 14px;
        border: 2px solid rgba(255, 255, 255, 0.4);
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .splash-loader-container {
        width: 68%;
        bottom: 61%; /* Optimale Position unter "POWERHABIT" */
    }

    .splash-loader-bg {
        height: 12px;
    }
}

/* ==================== DESKTOP SIDEBAR NAVIGATION ==================== */

/* Hide Desktop Sidebar on Mobile */
.desktop-sidebar {
    display: none;
}

/* Desktop Layout: Sidebar + Main Content (iPad and tablets show mobile view) */
@media (min-width: 1025px) {
    /* Hide splash screen on desktop */
    #splash-screen {
        display: none !important;
    }

    /* Desktop Sidebar Visible */
    .desktop-sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: calc(50% - 770px); /* Center: 500px (half content) + 250px (sidebar) + 20px (gap) */
        top: 0;
        bottom: 0;
        width: 250px;
        background: linear-gradient(to bottom, #d6e8d2, #f5e7d5); /* Gradient wie body */
        border-right: none; /* No separator line */
        padding: 160px 16px 24px 16px; /* Top padding to align with content */
        gap: 8px;
        z-index: 100;
    }

    .desktop-sidebar-item {
        display: flex;
        align-items: center;
        gap: 12px;
        background: none;
        border: none;
        padding: 12px 16px;
        cursor: pointer;
        transition: all 0.2s ease;
        color: var(--muted);
        border-radius: 8px;
        text-align: left;
        font-size: 1rem;
    }

    .desktop-sidebar-item:hover {
        background: var(--border-color);
        color: var(--fg);
    }

    .desktop-sidebar-item.active {
        background: var(--border-color);
        color: var(--fg);
        font-weight: 600;
    }

    .desktop-sidebar-icon {
        width: 24px;
        height: 24px;
        stroke: currentColor;
        flex-shrink: 0;
    }

    .desktop-sidebar-label {
        font-size: 0.95rem;
        font-weight: 600;
    }

    /* Adjust container for centered layout */
    .container {
        margin-left: auto;
        margin-right: auto;
        max-width: 1000px;
        padding-top: 24px;
        padding-left: 50px; /* Extra spacing from sidebar */
        position: relative; /* Make container a positioning context for hamburger button */
    }

    /* Show hamburger button on desktop (next to sidebar) */
    .hamburger-btn {
        display: flex !important;
        position: fixed;
        top: 16px;
        left: calc(50% - 770px + 250px + 20px); /* Align with sidebar: center - half content - sidebar width + gap */
        width: 44px;
        height: 44px;
        background: var(--bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1000;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }

    .hamburger-btn:hover {
        background: var(--bg-secondary);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* Hide footer on desktop (all links are in hamburger menu) */
    .page-footer {
        display: none !important;
    }
    
    /* Desktop: habit-card-content-area gap auf 0px */
    .habit-card-content-area {
        gap: 0px; /* Desktop: kein Gap */
    }
    
    /* Desktop: Badge Progress Text margin-top anpassen */
    .badge-progress-text {
        margin-top: -13px; /* Desktop: mehr nach oben */
    }
}

/* ==================================================
   DAILY SUMMARY SCREEN
   ================================================== */

/* Hide main app content initially when Daily Summary is active */
body.daily-summary-active .desktop-sidebar,
body.daily-summary-active .container {
    opacity: 0;
    visibility: hidden;
}

/* Smooth transition when app becomes visible after Daily Summary */
.desktop-sidebar,
.container {
    transition: opacity 0.4s ease-out;
}

/* Main overlay container - covers entire screen */
#daily-summary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000; /* Above everything */
    background: black; /* Fallback */
    display: flex;
    align-items: flex-start; /* Nicht zentriert - verhindert Layout-Shift */
    justify-content: center;
    padding-top: 15vh; /* Fester Abstand von oben - bleibt stabil */
    cursor: pointer; /* Indicates it's tappable */
}

/* Background image (Stadtfest or Cemetery) */
.daily-summary-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Initial: SCHWARZ - Bild noch nicht sichtbar */
    background-color: #000;
    opacity: 0;
    filter: brightness(0.6);
    transition: opacity 1.5s ease-out, filter 1.2s ease-out;
}

/* Fade in background after Powerhabit animation */
.daily-summary-background.visible {
    opacity: 1;
}

/* After background visible: blur for text focus */
.daily-summary-background.blurred {
    filter: brightness(0.6) blur(4px);
}

/* Content container (text overlay) */
.daily-summary-content {
    position: relative;
    z-index: 1; /* Above background */
    text-align: center;
    color: white;
    width: 90%;
    max-width: 500px;
    padding: 20px;
}

/* Powerhabit Title - GRÖßER und mit Flacker-Effekt */
.daily-summary-title {
    font-family: 'Inter', sans-serif;
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 20px; /* Noch weniger Abstand - alles höher */
    letter-spacing: -1px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

/* Wort-Gruppen (Power, habit) - nebeneinander ohne Lücke */
.word-group {
    display: inline-block;
}

/* Einzelne Buchstaben für Flacker-Effekt */
.flicker-letter {
    display: inline-block;
    opacity: 0;
    animation: flicker 0.8s ease-out forwards;
}

/* Flacker-Animation: Wie eine Glühbirne die angeht */
@keyframes flicker {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    }
    15% {
        opacity: 0;
    }
    25% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    }
    30% {
        opacity: 0.3;
    }
    35% {
        opacity: 1;
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
    }
    40% {
        opacity: 0;
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(255, 255, 255, 1);
    }
    55% {
        opacity: 0.8;
    }
    60% {
        opacity: 1;
    }
    65% {
        opacity: 0.9;
    }
    70%, 100% {
        opacity: 1;
        text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8),
                     0 0 30px rgba(255, 255, 255, 0.3);
    }
}

/* Quote wrapper - initially hidden, shown progressively */
.daily-summary-quote-wrapper {
    margin-top: 5px; /* Minimal - direkt unter Title */
    margin-bottom: 20px; /* Weniger Abstand zu Punkten */
    opacity: 0;
    transition: opacity 0.6s ease-out;
    max-width: 600px;
    min-height: 100px; /* Fester Platz - verhindert Verschieben wenn Punkte erscheinen */
}

.daily-summary-quote-wrapper.visible {
    opacity: 1;
}

/* Main fact text (larger, prominent) - initially hidden */
.daily-summary-quote-main {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.daily-summary-quote-main.visible {
    opacity: 1;
}

/* Info text below (smaller, supporting) - initially hidden */
.daily-summary-quote-info {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.daily-summary-quote-info.visible {
    opacity: 1;
}

/* Points number (big, animated) - initially hidden, shown progressively */
.daily-summary-points {
    font-family: 'Inter', sans-serif;
    font-size: 80px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.9); /* Neutral white - will be animated to green/orange */
    margin: 5px 0 5px 0; /* Minimal margin */
    min-height: 95px; /* Fester Platz - kein Springen */
    opacity: 0;
    transition: opacity 0.6s ease-out;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.daily-summary-points.visible {
    opacity: 1;
}

/* Note: No sign (+/-) displayed - context is given by label text */
/* Color animation is handled via JavaScript during counting */

/* Label below points - initially hidden, shown progressively */
.daily-summary-label {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 300;
    margin-bottom: 15px; /* Noch weniger */
    min-height: 24px; /* Fester Platz - kein Springen */
    opacity: 0;
    transition: opacity 0.6s ease-out;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.daily-summary-label.visible {
    opacity: 1;
}

/* CTA Container - initially hidden, shown when app is ready */
.daily-summary-cta {
    margin-top: 20px; /* Noch weniger */
    opacity: 0;
    transition: opacity 0.6s ease-out;
    min-height: 75px; /* Reserviert Platz für Button - verhindert Layout-Shift */
}

.daily-summary-cta.visible {
    opacity: 1;
}

/* CTA Button styling */
.daily-summary-cta-button {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 700;
    padding: 16px 48px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transition: all 0.2s ease;
}

.daily-summary-cta-button:hover {
    background: #45a049;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

.daily-summary-cta-button:active {
    transform: scale(0.98);
}

/* Fade in with slight upward movement */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Mobile and Tablet optimizations (includes iPad) */
@media (max-width: 1024px) {
    .daily-summary-title {
        font-size: 44px;
        margin-bottom: 40px;
    }

    .daily-summary-quote-wrapper {
        margin-bottom: 30px;
        max-width: 90%;
        padding: 0 20px;
    }

    .daily-summary-quote-main {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .daily-summary-quote-info {
        font-size: 13px;
        line-height: 1.6;
    }

    .daily-summary-points {
        font-size: 64px;
    }

    .daily-summary-label {
        font-size: 14px;
        margin-bottom: 40px;
    }

    .daily-summary-cta {
        margin-top: 40px;
    }

    .daily-summary-cta-button {
        font-size: 16px;
        padding: 14px 40px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .daily-summary-title {
        font-size: 38px;
        margin-bottom: 30px;
    }

    .daily-summary-quote {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .daily-summary-points {
        font-size: 56px;
    }

    .daily-summary-cta-button {
        font-size: 15px;
        padding: 12px 32px;
    }
}

/* ============================================================
   LEVEL PROGRESS STEPPER (Extended: -33 to +55 levels)
   ============================================================ */

.stepper-container {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Viewport with overflow hidden (shows only visible portion) */
.stepper-viewport {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.stepper-svg {
    width: 158.93%; /* 1780px / 1120px = ~1.589 (extended for 89 circles) */
    height: 30px;
    display: block;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    /* Default: Hide cemetery on left, show only positive levels */
    transform: translateX(-37%);
}

/* When in cemetery (negative levels), shift to show cemetery */
.stepper-svg.show-cemetery {
    transform: translateX(0%); /* Reset to show cemetery levels */
}

/* Background line (gray) */
.stepper-line-bg {
    stroke: #9ca3af;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Progress line (filled) */
.stepper-line-progress {
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: x1 0.4s ease-out, x2 0.4s ease-out, stroke 0.4s ease-out;
}

/* Progress line in positive range (green) */
.stepper-line-progress.positive {
    stroke: #10b981;
}

/* Progress line in cemetery range (red/orange) */
.stepper-line-progress.cemetery {
    stroke: #ef4444;
}

/* Circles - default state */
.stepper-circle {
    fill: transparent;
    stroke: #6b7280;
    stroke-width: 2;
    r: 4;
    transition: all 0.3s ease;
}

/* Cemetery circles (negative levels) - reddish tint */
.stepper-circle.cemetery-level {
    stroke: #f87171;
    stroke-width: 2;
}

.stepper-circle.cemetery-level.filled {
    fill: #ef4444;
    stroke: #ef4444;
    stroke-width: 2.5;
}

/* Positive circles - default gray */
.stepper-circle.positive-level {
    stroke: #6b7280;
    stroke-width: 2;
}

/* Filled circles (completed levels in positive range) */
.stepper-circle.positive-level.filled {
    fill: #10b981;
    stroke: #10b981;
    stroke-width: 2.5;
}

/* Progress Marker - shows exact position between levels */
.progress-marker {
    fill: #3b82f6;
    stroke: #fff;
    stroke-width: 2;
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 1))
            drop-shadow(0 0 20px rgba(59, 130, 246, 0.8));
    transition: cx 0.4s ease-out;
    pointer-events: none;
    /* Pulse animation via JavaScript für Mobile-Kompatibilität */
}

/* Progress marker in cemetery range (orange) */
.progress-marker.cemetery {
    fill: #f97316;
    stroke: #fff;
    filter: drop-shadow(0 0 12px rgba(249, 115, 22, 1))
            drop-shadow(0 0 20px rgba(249, 115, 22, 0.8));
}

/* Level number display */
.stepper-level-number {
    display: none; /* Hidden - progress marker shows exact position visually */
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 500;
}

/* Negative level indicator */
.stepper-level-number.negative {
    color: #ef4444;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stepper-level-number {
        font-size: 11px;
    }
}

/* ============================================================
   MOTIVATIONAL TEXT DISPLAY (Fade-in/Fade-out)
   ============================================================ */

.lcd-marquee-container {
    margin-top: 12px;
    padding: 12px 16px;
    background: transparent;
}

.lcd-marquee-viewport {
    position: relative;
    width: 100%;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lcd-marquee-text {
    width: 100%;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #555555;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    line-height: 1.5;
}

.lcd-marquee-text.fade-in {
    opacity: 1;
}

.lcd-marquee-text.fade-out {
    opacity: 0;
}

/* Responsive: Kleinere Schrift auf Mobile */
@media (max-width: 768px) {
    .lcd-marquee-text {
        font-size: 17px;
    }
    .lcd-marquee-container {
        padding: 10px 12px;
    }
}

/* Sync Button in header: Hide only sync button and status, keep hamburger visible */
#sync-button,
#sync-status {
    display: none !important;
}

/* === NOTIZZETTEL POPUP === */
.note-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.note-popup.hidden {
  display: none;
}

.note-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.note-container {
  position: relative;
  width: 85%;
  max-width: 360px;
  z-index: 10000;
  animation: noteSlideIn 0.3s ease-out;
  cursor: pointer; /* Zeigt Hand-Cursor */
}

.note-image {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.note-text {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 75%;
  text-align: center;
  pointer-events: auto; /* Text ist jetzt klickbar */
  cursor: pointer; /* Zeigt Hand-Cursor */
}

.note-text p {
  font-size: 22px;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.4;
  margin: 0;
}

@keyframes noteSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive: Kleinere Handys */
@media (max-width: 375px) {
  .note-container {
    width: 90%;
  }
  
  .note-text p {
    font-size: 20px;
  }
}

/* Responsive: Große Tablets */
@media (min-width: 768px) {
  .note-container {
    max-width: 400px;
  }

  .note-text p {
    font-size: 26px;
  }
}


/* ========================================
   MUSEUM / TROPHY ROOM
   ======================================== */

#museumContainer {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 60vh;
}

/* View Toggle Buttons */
.museum-view-toggle {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 30px;
  padding: 10px;
}

.view-toggle-btn {
  padding: 8px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.view-toggle-btn:hover {
  border-color: #aad780;
  background: rgba(170, 215, 128, 0.1);
}

.view-toggle-btn.active {
  background: #aad780;
  border-color: #aad780;
  color: white;
}

.view-toggle-btn svg {
  width: 20px;
  height: 20px;
}

.view-toggle-btn.active svg {
  color: white;
}

/* Timeline Grid (chronological view) */
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: -35px;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  justify-items: center;
  align-items: center;
}

/* Timeline view items - Trophy items normal size */
.timeline-grid .trophy-item {
  width: 100px;
  height: auto;
  margin: 0;
}

/* Timeline Medal items werden weiter unten separat definiert */

/* Shelf Header (colored label) */
.shelf-header {
  text-align: center;
  padding: 10px 20px;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  background: #aad780;
}

/* Trophy Grid */
.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  padding: 0px;
  justify-items: center;
  align-items: center;
  min-height: 51px;
}

.trophy-item {
  width: 100px;
  height: auto;
  cursor: pointer;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.trophy-item:hover {
  transform: translateY(-8px) scale(1.05);
}

.trophy-item:active {
  transform: translateY(-4px) scale(0.98);
}

/* Medals Section */
.medals-section {
  margin-top: 40px;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.medals-header {
  text-align: center;
  padding: 10px 20px;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  background: #aad780;
}

/* Timeline view items - same size as sorted view */
.timeline-grid .trophy-item {
  width: 100px;
  height: auto;
}

.timeline-grid .medal-item {
  width: 42px; /* Nochmal halbiert (von 85px) */
  height: auto;
  margin: -5px; /* Kleiner Overlap für kleinere Medaillen */
}

/* Medals Grid - Gleiche Größe wie Chronologisch */
.medals-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  column-gap: 0;
  row-gap: 8px;
  padding: 10px;
  justify-items: center;
}

.medal-item {
  width: 42px; /* Gleiche Größe wie Timeline */
  height: auto;
  cursor: pointer;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  transform-origin: top center;
  margin: -8px; /* Overlap angepasst für kleinere Größe */
}

.medal-item:hover {
  animation: medalSwing 0.5s ease-in-out;
}

@keyframes medalSwing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* Museum Statistics */
.museum-stats {
  margin-top: 50px;
  padding: 30px 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: none; /* Hidden - removed from UI */
}

.stat-divider {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--border-color),
    transparent
  );
  margin: 20px 0;
}

.stat-header {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 25px;
  letter-spacing: 0.5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  color: #000000;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 15px;
  color: #000000;
  font-weight: 500;
}

.stat-message {
  text-align: center;
  font-size: 17px;
  font-style: italic;
  color: var(--muted);
  font-weight: 500;
}

/* Trophy Details Popup */
.trophy-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.trophy-popup {
  background: white;
  padding: 35px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 90%;
  animation: popupSlideIn 0.3s ease;
}

.popup-trophy-image {
  width: 120px;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.popup-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 10px 0;
  line-height: 1.3;
}

.popup-medal-type {
  font-size: 18px;
  font-weight: 700;
  color: var(--ok);
  margin: 8px 0;
}

.popup-subtitle {
  font-size: 16px;
  color: var(--muted);
  margin: 8px 0;
}

.popup-date {
  font-size: 14px;
  color: var(--muted);
  margin-top: 12px;
  font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Streak Pulse Animation - für pending Habits */
@keyframes streakPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.stat-value-streak.animated,
.inline-number.animated {
  animation: streakPulse 2s ease-in-out infinite;
  display: inline-block;
  transform-origin: center center;
  font-weight: 800;
}

/* Sync Icon Rotation Animation */
@keyframes syncRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.sync-icon.rotating {
  animation: syncRotate 1s linear infinite;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  #museumContainer {
    padding: 15px;
  }

  .museum-view-toggle {
    margin-bottom: 20px;
    justify-content: flex-start;
  }

  .view-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 6px;
  }

  .timeline-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    padding: 15px;
  }

  .timeline-grid .trophy-item {
    width: 60px;
  }

  .timeline-grid .medal-item {
    width: 35px; /* Klein für Mobile */
  }

  .shelf-header {
    font-size: 14px;
    padding: 8px 15px;
  }

  .trophy-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }

  .trophy-item {
    width: 60px;
  }

  .medals-section {
    padding: 20px 15px;
  }

  .medals-header {
    font-size: 14px;
    padding: 8px 15px;
  }

  .medals-grid {
    grid-template-columns: repeat(6, 1fr);
    column-gap: 0;
    row-gap: 6px;
  }

  .medal-item {
    width: 35px; /* Gleiche Größe wie Timeline Mobile */
    margin: -6px;
  }

  .stat-grid {
    gap: 15px;
  }

  .stat-value {
    font-size: 45px;
  }

  .stat-value-best {
    font-size: 28px !important; /* Best kleiner auf Tablet */
    height: 28px !important;
  }

  .stat-label {
    font-size: 13px;
  }

  .stat-message {
    font-size: 15px;
  }

  .popup-trophy-image {
    width: 100px;
  }

  .popup-title {
    font-size: 19px;
  }

  .popup-subtitle {
    font-size: 14px;
  }
}

/* Responsive - Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
  .trophy-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  .trophy-item {
    width: 90px;
  }

  .medals-grid {
    grid-template-columns: repeat(10, 1fr);
    column-gap: 0;
    row-gap: 8px;
  }

  .medal-item {
    width: 40px;
    margin: -8px;
  }
}

/* Responsive - Desktop */
@media (min-width: 1024px) {
  .trophy-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .trophy-item {
    width: 100px;
  }

  .medals-grid {
    grid-template-columns: repeat(10, 1fr);
    column-gap: 0;
    row-gap: 8px;
  }

  .medal-item {
    width: 42px; /* Gleiche Größe wie Timeline */
    margin: -8px;
  }
}

/* ==========================================
   PROGRESS SPARK ANIMATIONS (Zündschnur-Effekt)
   ========================================== */

/* Pulsierendes Glühen - wie eine brennende Zündschnur (grün) */
@keyframes spark-pulse {
  0%, 100% {
    transform: translateY(-50%) scale(1);
    box-shadow:
      0 0 8px hsl(116, 40%, 60%),
      0 0 16px hsl(124, 41%, 46%),
      0 0 24px hsl(132, 42%, 41%);
    opacity: 1;
  }
  50% {
    transform: translateY(-50%) scale(1.3);
    box-shadow:
      0 0 12px hsl(116, 40%, 60%),
      0 0 24px hsl(124, 41%, 46%),
      0 0 36px hsl(132, 42%, 41%),
      0 0 48px hsl(140, 44%, 37%);
    opacity: 0.9;
  }
}

/* Schnelles Flackern - wie echte Funken */
@keyframes spark-flicker {
  0%, 100% {
    opacity: 1;
  }
  25% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
  75% {
    opacity: 0.9;
  }
}

/* Funken-Punkt standardmäßig unsichtbar */
.progress-spark {
  opacity: 0;
  transition: opacity 2s ease-out, box-shadow 2s ease-out; /* Sehr langsames sanftes Ausblenden */
}

/* Funken-Punkt aktiv wenn Progress sich ändert - MIT Animation */
.progress-spark.active {
  opacity: 1;
  animation: spark-pulse 0.8s ease-in-out infinite, spark-flicker 0.3s ease-in-out infinite;
  box-shadow: 0 0 8px hsl(116, 40%, 60%), 0 0 16px hsl(124, 41%, 46%), 0 0 24px hsl(132, 42%, 41%);
  transition: opacity 0.1s ease-in; /* Schnelles Einblenden */
}

/* Funken-Animation beendet - Sanftes Ausblenden */
.progress-spark.fading {
  animation: none; /* Animation stoppen */
  transition: opacity 2s ease-out, box-shadow 2s ease-out; /* Smooth Fade-out über 2 Sekunden */
}

/* Verstecke Funken immer bei 0% */
#habits-progress-fill[style*="width: 0%"] .progress-spark,
#fullscreen-progress-fill[style*="width: 0%"] .progress-spark {
  opacity: 0 !important;
}

/* ==========================================
   PROGRESSIVE HABIT MODAL - PHASE 1
   ========================================== */

/* Overlay (Glass-Look mit Blur) */
#progressive-habit-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
}

/* Modal Container (Glass-Look) */
#progressive-habit-modal .modal-content.glass-modal {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Modal Header */
.modal-header.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Glass Text (Labels, Header) */
.glass-text {
    color: #ffffff;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
    font-size: 1.5rem;
}

/* Close Button */
.modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Progressive Content Container */
#progressive-content {
    margin-top: 12px;
}

/* Progressive Question Container */
.progressive-question {
    margin-bottom: 24px;
}

/* Glass Label (Passive) */
.glass-label {
    display: block;
    color: #ffffff;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
}

/* Paper Input (Interactive) */
.paper-input {
    width: 100%;
    background: #ffffff;
    color: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s ease;
    /* Neumorphismus-Schatten */
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.paper-input:focus {
    outline: none;
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(16, 185, 129, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.paper-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* Glass Hint (Passive) */
.glass-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
}

/* Textarea (Paper-Look, same as input) */
textarea.paper-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Collapsed Item (Glass-Look) */
.progressive-collapsed {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.progressive-collapsed:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Disabled/Grayed out state for questions during editing */
.progressive-question.disabled,
.progressive-collapsed.disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(0.6);
}

.collapsed-check {
    color: #10b981;
    font-weight: bold;
    font-size: 1.1rem;
}

.collapsed-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    margin: 0 6px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    vertical-align: middle;
}

.collapsed-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.collapsed-label {
    font-weight: 600;
    opacity: 0.7;
    margin-right: 4px;
}

/* Progressive Icon Picker Carousel */
.progressive-icon-picker {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.progressive-icon-picker-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.icon-picker-carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.icon-carousel-arrow {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    font-weight: bold;
    flex-shrink: 0;
}

.icon-carousel-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.icon-carousel-arrow:active {
    transform: scale(0.95);
}

.icon-carousel-icons {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.icon-carousel-item {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    flex-shrink: 0;
}

.icon-carousel-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.icon-carousel-item.selected {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.icon-carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile adjustments for icon picker */
@media (max-width: 768px) {
    .icon-carousel-item {
        width: 32px;
        height: 32px;
        padding: 4px;
    }

    .icon-carousel-arrow {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .icon-carousel-icons {
        gap: 4px;
    }

    .icon-picker-carousel {
        gap: 4px;
    }
}

/* Glass Skip Button */
.glass-skip-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.glass-skip-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

/* Slide-in Animation for new questions */
.slide-in {
    animation: slideInFromBottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progressive Type Toggle (Paper-Look with Pill-Slider) - 3 Buttons */
.progressive-type-toggle {
    display: flex;
    gap: 0;
    padding: 4px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    margin-bottom: 12px;
    position: relative;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Progressive Two Toggle (Paper-Look with Pill-Slider) - 2 Buttons */
.progressive-two-toggle {
    display: flex;
    gap: 0;
    padding: 4px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    margin-bottom: 12px;
    position: relative;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Pill-Slider für 2-Button Toggle */
.progressive-two-toggle::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* Pill Position für 2. Button (fixed or weekly) */
.progressive-two-toggle:has([data-mode="fixed"].active)::before,
.progressive-two-toggle:has([data-frequency="weekly"].active)::before {
    transform: translateX(calc(100% + 4px));
}

/* Buttons in Two-Toggle */
.progressive-two-toggle .type-btn {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.55);
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    text-align: center;
}

.progressive-two-toggle .type-btn:hover {
    color: rgba(0, 0, 0, 0.75);
}

.progressive-two-toggle .type-btn.active {
    color: rgba(0, 0, 0, 0.9);
}

/* Pill-Slider (bewegt sich zwischen 3 Buttons) */
.progressive-type-toggle::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(33.333% - 4px);
    height: calc(100% - 8px);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* Pill Position für Counter (2. Button) */
.progressive-type-toggle:has([data-type="counter"].active)::before {
    transform: translateX(calc(100% + 4px));
}

/* Pill Position für Limit (3. Button) */
.progressive-type-toggle:has([data-type="limit-counter"].active)::before {
    transform: translateX(calc(200% + 8px));
}

/* Frequency Toggle - 2 Buttons (Daily/Weekly) override */
.progressive-type-toggle.frequency-two-toggle::before {
    width: calc(50% - 4px);
}

.progressive-type-toggle.frequency-two-toggle:has([data-frequency="weekly"].active)::before {
    transform: translateX(calc(100% + 4px));
}

/* Pill Position für Frequency Toggle - Monthly (3. Button, hidden - for re-enabling) */
.progressive-type-toggle:not(.frequency-two-toggle):has([data-frequency="weekly"].active)::before {
    transform: translateX(calc(100% + 4px));
}
.progressive-type-toggle:not(.frequency-two-toggle):has([data-frequency="monthly"].active)::before {
    transform: translateX(calc(200% + 8px));
}

/* Type Buttons */
.progressive-type-toggle .type-btn {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.55);
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    text-align: center;
}

.progressive-type-toggle .type-btn:hover {
    color: rgba(0, 0, 0, 0.75);
}

.progressive-type-toggle .type-btn.active {
    color: rgba(0, 0, 0, 0.9);
}

/* Paper Next Button (Weiter →) */
.paper-next-btn {
    padding: 12px 24px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.paper-next-btn:hover {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.paper-next-btn:active {
    transform: translateY(0);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Weekday Grid */
.weekday-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 12px;
}

/* Nicht gewählte Wochentage = Glass-Look */
.weekday-btn {
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.weekday-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.85);
}

/* Gewählte Wochentage = Paper-Look (deutlich weiß) */
.weekday-btn.active {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.95);
    font-weight: 700;
    text-shadow: none;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.weekday-btn.active:hover {
    transform: translateY(-3px);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.2),
        0 3px 6px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.weekday-btn:active {
    transform: translateY(0);
}

/* Monthday Grid (1-31 Buttons) */
.monthday-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 12px;
}

/* Nicht gewählte Monatstage = Glass-Look */
.monthday-btn {
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.monthday-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.85);
}

/* Gewählte Monatstage = Paper-Look (deutlich weiß) */
.monthday-btn.active {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.95);
    font-weight: 700;
    text-shadow: none;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.monthday-btn.active:hover {
    transform: translateY(-3px);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.2),
        0 3px 6px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.monthday-btn:active {
    transform: translateY(0);
}

/* Animation beim Öffnen */
#progressive-habit-modal.opening .modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============ TIME WHEEL PICKER (Apple-Style) ============ */
.time-wheel-picker {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    height: 200px;
    margin: 24px auto;
    max-width: 240px;
    user-select: none;
    -webkit-user-select: none;
    overflow-x: hidden;
    touch-action: pan-y;
}

.time-wheel-column {
    flex: 0 0 80px;
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    text-align: center;
    position: relative;
    z-index: 2;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.time-wheel-column::-webkit-scrollbar {
    display: none;
}

.time-wheel-spacer {
    height: 80px;
    pointer-events: none;
    flex-shrink: 0;
}

.time-wheel-item {
    height: 40px;
    line-height: 40px;
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-primary);
    opacity: 0.4;
    scroll-snap-align: center;
    scroll-snap-stop: normal;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.time-wheel-item.active {
    opacity: 1;
    font-weight: 700;
    transform: scale(1.15);
}

.time-wheel-item.adjacent {
    opacity: 0.7;
}

.time-wheel-separator {
    flex: 0 0 auto;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    pointer-events: none;
    position: relative;
    z-index: 3;
}

.time-wheel-highlight {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 44px;
    pointer-events: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

.time-wheel-picker::before,
.time-wheel-picker::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 50px;
    pointer-events: none;
    z-index: 4;
}

.time-wheel-picker::before {
    top: 0;
    background: linear-gradient(to bottom, #fefefe, rgba(254, 254, 254, 0));
}

.time-wheel-picker::after {
    bottom: 0;
    background: linear-gradient(to top, #fefefe, rgba(254, 254, 254, 0));
}
