/* static/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #ffffff; color: #2d0648;
}

.page {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; flex-direction: column; position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.05);
}

header {
  padding: 16px 24px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; z-index: 20; background: rgba(255,255,255,0.95); 
  border-bottom: 1px solid #f3f4f6;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }

.main-container {
  flex: 1; display: flex; overflow: hidden; position: relative;
}

.chat-section {
  flex: 1; display: flex; flex-direction: column; position: relative;
  width: 100%;
}

#chat {
  flex: 1; overflow-y: auto; 
  padding: 20px 15% 120px 15%;
  scrollbar-width: none;
}
#chat::-webkit-scrollbar { display: none; }

.notepad-section {
  width: 340px; background: #fdfbff; border-left: 1px solid #f3e8ff;
  display: flex; flex-direction: column; padding: 24px; overflow-y: auto; display: none;
}
@media (min-width: 1100px) { .notepad-section { display: flex; } }

.notepad-header {
  font-size: 12px; font-weight: 700; color: #a78bfa; 
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 20px; padding-bottom: 10px;
  border-bottom: 2px solid #f3e8ff;
}

.belief-card {
  background: white; border: 1px solid #e9d5ff; border-radius: 16px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.03); 
  transition: all 0.2s ease; cursor: pointer;
}
.belief-card:hover { 
  transform: translateY(-3px); box-shadow: 0 8px 20px rgba(124, 58, 237, 0.08); border-color: #d8b4fe;
}
.belief-text { font-size: 15px; color: #4c1d95; margin-bottom: 8px; line-height: 1.4; font-weight: 500; }
.belief-status { font-size: 11px; color: #9ca3af; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f472b6; }

.msg { margin-bottom: 28px; display: flex; opacity: 0; animation: fadeIn 0.3s forwards; gap: 14px; }
.msg.me { justify-content: flex-end; align-items: flex-start; }
.msg.bot { justify-content: flex-start; align-items: flex-start; }

/* Avatar użytkownika w chacie */
.user-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  overflow: hidden; order: 2;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e9d5ff 0%, #f3e8ff 100%);
  border: 1px solid #e9d5ff;
}
.user-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.user-avatar-letter {
  font-size: 16px;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
}

.bot-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: #fbf7ff;
  border: 1px solid #f3e8ff;
}
.bot-avatar img { width: 24px; height: 24px; object-fit: contain; }

.spinning { animation: spin 2s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.bubble { display: inline-block; max-width: 85%; font-size: var(--chat-font-size, 16px); line-height: 1.6; }
.bubble-me { padding: 14px 22px; border-radius: 24px; background: #f3f4f6; color: #1f2933; border-bottom-right-radius: 4px; }
.bubble-bot { padding: 8px 0 0 0; background: transparent; color: #2d0648; }

/* ========================================
   ⌨️ STREAMING (Simple): Typewriter (no blur / no ink fragments)
   - During SSE streaming we show plain text being typed live.
   - On done we render final markdown (marked.parse) as before.
======================================== */
.stream-bubble.ink-streaming .ink-stream {
  white-space: pre-wrap;
  word-break: break-word;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.stream-bubble.ink-streaming .ink-line { display: block; }
.stream-bubble.ink-streaming .ink-line.ink-empty {
  min-height: 0.9em;
  margin-top: 0.55em;
}

.audio-player-container {
  margin-top: 12px; padding: 16px; background: #fbf7ff; 
  border: 1px solid #e9d5ff; border-radius: 16px; width: 100%; max-width: 320px;
  animation: fadeIn 1s ease; display: flex; flex-direction: column; gap: 8px;
}
.audio-label { font-size: 11px; font-weight: 700; color: #7c3aed; text-transform: uppercase; }
audio { width: 100%; height: 32px; outline: none; }
audio::-webkit-media-controls-panel { background-color: #fbf7ff; }

.input-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: linear-gradient(to top, #ffffff 80%, rgba(255,255,255,0) 100%);
  padding: 20px 24px 30px 24px; z-index: 10;
}
/* ========================================
   🏥 DISCLAIMER MEDYCZNY
======================================== */
.medical-disclaimer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(156, 163, 175, 0.5); /* Bardzo blady szary */
  padding: 4px;
  z-index: 5;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.8);
}

/* Input bar ZAWSZE na dole - bez animacji centrowania */
/* body.initial .input-bar { bottom: 50%; transform: translateY(50%); background: transparent; } */

.input-inner { 
  width: 100%; max-width: 720px; position: relative;
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
}
.input-row { 
  display: flex; gap: 8px; align-items: flex-end; background: white;
  padding: 6px 6px 6px 6px; border-radius: 32px; flex: 1;
  box-shadow: 0 10px 40px -10px rgba(124, 58, 237, 0.15); border: 1px solid #e9d5ff;
  transition: all 0.3s ease;
}
.input-row:focus-within {
  box-shadow: 0 15px 50px -10px rgba(124, 58, 237, 0.25); border-color: #a78bfa; transform: translateY(-2px);
}
/* Form wewnątrz input-row */
.input-form {
  display: flex; gap: 12px; align-items: flex-end; flex: 1;
}
textarea {
  flex: 1; padding: 12px 16px; border-radius: 24px; border: none; 
  font-size: 16px; outline: none; resize: none; min-height: 24px; max-height: 120px;
  font-family: inherit; background: transparent;
}
textarea:disabled { opacity: 0.6; cursor: not-allowed; }

/* Przycisk wysyłania */
.input-row .send-btn { 
  width: 44px; height: 44px; border-radius: 50%; border: none; 
  background: #7c3aed; color: #fff; font-size: 20px; cursor: pointer; 
  flex-shrink: 0; transition: transform 0.2s, background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.send-btn:hover { background: #6d28d9; transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #a78bfa; transform: none; }

/* MENU HAMBURGER - wewnątrz pola dialogowego */
.menu-toggle {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid #e9d5ff;
  background: #faf5ff; cursor: pointer; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 0; transition: all 0.2s;
  pointer-events: auto !important; /* Zawsze klikalne */
  opacity: 1 !important; /* Nigdy nie wyszarzaj */
  position: relative;
  z-index: 20; /* Ponad innymi elementami */
}
.menu-toggle:hover { background: #f3e8ff !important; }
.menu-toggle:active { background: #e9d5ff !important; }
.menu-toggle span {
  display: block; width: 20px; height: 2px; background: #7c3aed;
  border-radius: 2px; transition: all 0.2s; flex-shrink: 0;
}
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Ukryj stary notebook trigger */
.notebook-trigger { display: none !important; }

.input-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  background: white; border-radius: 16px; padding: 8px;
  box-shadow: 0 10px 40px -10px rgba(124, 58, 237, 0.25);
  border: 1px solid #e9d5ff; min-width: 200px;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 100; /* Zawsze na wierzchu */
  pointer-events: auto !important;
}
.input-menu.active {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; border: none; background: transparent;
  border-radius: 12px; cursor: pointer; transition: background 0.2s;
  font-size: 15px; color: #2d0648; text-align: left;
}
.menu-item:hover { background: #f3e8ff; }
.menu-icon { font-size: 20px; }
.menu-icon-img { width: 24px; height: 24px; object-fit: contain; }
.menu-icon-svg { width: 24px; height: 24px; color: #7c3aed; flex-shrink: 0; }
.menu-text { flex: 1; font-weight: 500; }
.menu-badge {
  background: #7c3aed; color: white; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; min-width: 20px; text-align: center;
}
.menu-badge:empty, .menu-badge[data-count="0"] { display: none; }
.menu-divider {
  height: 1px; background: #e9d5ff; margin: 8px 0;
}

/* Przycisk instalacji PWA */
.menu-item-install {
  background: rgba(34, 197, 94, 0.12) !important;
  border: 1px solid rgba(34, 197, 94, 0.25) !important;
  border-radius: 10px !important;
  margin: 4px 24px !important;
  padding: 10px 16px !important;
  width: auto !important;
  align-self: flex-start !important;
  transition: all 0.2s ease;
}
.menu-item-install:hover {
  background: rgba(34, 197, 94, 0.18) !important;
}
.menu-item-install .menu-icon-svg {
  color: #16a34a;
}
.menu-item-install .menu-text {
  color: #15803d;
  font-weight: 500;
}

/* LUSTRO RZECZYWISTOŚCI */
#truth-overlay {
  position: fixed; 
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; 
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height - uwzględnia klawiaturę na mobile */
  display: none; 
  align-items: center; justify-content: center; 
  z-index: 99999; /* Najwyższy z-index - nad wszystkim */
  opacity: 0; 
  transition: opacity 0.8s ease-in-out;
  /* Zapobiegaj scrollowaniu pod overlayem */
  overflow: hidden;
  touch-action: none;
}
#truth-overlay.active { opacity: 1; }

/* Ukryj input-bar gdy lustro jest aktywne (mobile fix) */
body.mirror-active .input-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.truth-backdrop {
  position: absolute; inset: 0;
  /* ZMIANA NA ŚCIEŻKĘ BEZ SLASHA (BEZPIECZNIEJSZA LOKALNIE) */
  background: url('mirror-bg.png') no-repeat center center;
  background-size: cover;
  box-shadow: inset 0 0 200px rgba(0,0,0,0.9);
}
.truth-backdrop::after {
    content: ''; position: absolute; inset: 0;
    background: rgba(10, 5, 20, 0.6);
}

.truth-modal {
  position: relative; width: 95%; max-width: 1200px; height: 90%; max-height: 800px;
  display: flex; flex-direction: row;
  background: transparent; border: none; box-shadow: none; overflow: hidden;
  transform: scale(0.95); transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}
#truth-overlay.active .truth-modal { transform: scale(1); }

.truth-visual {
  flex: 1.2; position: relative; display: flex; align-items: center; justify-content: center;
}
.visual-wrapper {
  position: relative; width: 100%; max-width: 650px; aspect-ratio: 1/1.2;
}
.img-body {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; z-index: 1;
  filter: drop-shadow(0 0 25px rgba(251, 191, 36, 0.4));
}
.img-mind {
  position: absolute; 
  top: 5%; left: 7.5%; width: 85%; height: auto;
  object-fit: contain; z-index: 2;
  transition: all 3s ease-in-out;
}

.truth-content-col {
  flex: 1; display: flex; flex-direction: column;
  padding: 40px 40px; justify-content: center; position: relative;
}
.mirror-row {
  margin-bottom: 0; position: relative;
  padding-left: 30px; border-left: 4px solid rgba(255,255,255,0.15);
  transition: all 3s ease-in-out;
}

/* Pozycjonowanie tekstów względem sylwetki */
.row-mind { 
  margin-top: 30px;  /* Na wysokości kłębka w głowie */
  margin-bottom: 0; 
  margin-left: -190px;  /* Bliżej głowy (w lewo) */
} 
.row-body { 
  margin-top: 270px;  /* Na wysokości złotego koła (serca) */
} 

.label-mind { 
  color: #a3b4c8; font-size: 16px; text-transform: uppercase; letter-spacing: 3px; margin-bottom: 16px; display: block; font-weight: 600;
}
.label-body {
  color: #fbbf24; font-size: 16px; text-transform: uppercase; letter-spacing: 3px; margin-bottom: 16px; display: block; font-weight: 600;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
}
.text-mind { 
  color: #e2e8f0; font-size: 32px; line-height: 1.3; transition: all 3s ease-in-out; font-weight: 500; 
}
.text-body { 
  color: #ffffff; font-size: 38px; font-weight: 700; line-height: 1.2; text-shadow: 0 2px 15px rgba(0,0,0,0.6); 
}

.dissolving { opacity: 0; filter: blur(20px); transform: translateY(-40px) scale(0.9); }

.truth-close {
  position: absolute; top: 20px; right: 20px; background: none; border: none;
  color: #ffffff; font-size: 48px; cursor: pointer; z-index: 10; transition: transform 0.2s;
  text-shadow: 0 0 10px rgba(0,0,0,0.5); line-height: 1;
}
.truth-close:hover { transform: scale(1.1); }

@media (max-width: 800px) {
  .truth-modal { 
    flex-direction: column; 
    height: 100%; 
    padding: 20px;
    position: relative;
  }
  
  /* Na mobile: obrazek zajmuje większość ekranu */
  .truth-visual { 
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .visual-wrapper { 
    width: 75%;  /* Zwiększone z 70% - grafika większa */
    max-width: 330px;  /* Zwiększone z 300px */
    position: relative;
  }
  
  /* Teksty NAŁOŻONE na obrazek */
  .truth-content-col { 
    position: absolute;
    inset: 0;
    padding: 60px 15px 80px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
  }
  
  .mirror-row {
    pointer-events: auto;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    padding: 10px 14px;  /* Zmniejszone z 12px 16px */
    border-radius: 12px;
    border-left: 3px solid rgba(255,255,255,0.3);
    max-width: 85%;
  }
  
  /* ILLUSION - na górze, przy głowie */
  .row-mind { 
    margin: 0;
    align-self: flex-end;
  }
  
  /* FACT - na dole, przy złotym kole */
  .row-body { 
    margin: 0;
    align-self: flex-start;
  }
  
  .text-mind { font-size: 16px; line-height: 1.3; }  /* Zmniejszone z 18px */
  .text-body { font-size: 18px; line-height: 1.3; }  /* Zmniejszone z 20px */
  .label-mind, .label-body { font-size: 9px; letter-spacing: 2px; margin-bottom: 6px; }  /* Zmniejszone z 10px/8px */
  
  .truth-close { top: 10px; right: 10px; font-size: 36px; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* static/style.css - WKLEJ TO NA SAMYM DOLE, ZASTĘPUJĄC POPRZEDNIĄ SEKCJĘ LOGOWANIA */

/* =========================================
   ROZDZIAŁ 5: STRONA LOGOWANIA (LOGIN UI) - WERSJA Z LOGO PO LEWEJ
   ========================================= */

body.login-page {
  background-color: #fbf7ff;
  background-image: radial-gradient(circle at center, #ffffff 0%, #f3e8ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: auto;
}

.login-container {
  width: 100%;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.login-card {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  padding: 40px 30px;
  border-radius: 24px;
  box-shadow: 0 10px 40px -10px rgba(124, 58, 237, 0.15);
  text-align: center;
  animation: fadeIn 0.5s ease-out;
  border: 1px solid #f3e8ff;
}

/* --- NOWY NAGŁÓWEK (LOGO + TEKST OBOK SIEBIE) --- */
.login-header {
  display: flex;
  align-items: center; /* Wyrównanie w pionie */
  justify-content: center; /* Wyrównanie w poziomie na środku karty */
  gap: 12px; /* Odstęp między logo a napisem */
  margin-bottom: 8px;
}

.login-logo-small {
  width: 32px; /* Mniejsze logo, żeby pasowało do tekstu */
  height: 32px;
  object-fit: contain;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0; /* Usuwamy domyślne marginesy */
  color: #2d0648;
  letter-spacing: -0.5px;
}
/* -------------------------------------------------- */

.login-subtitle {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 30px;
}

.btn-google {
  width: 100%;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-google:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
}
.btn-google img { width: 18px; height: 18px; }

.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: #e5e7eb;
}
.divider span { padding: 0 10px; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #ffffff;
}
.form-group input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.btn-login {
  width: 100%;
  background: #7c3aed;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.btn-login:hover {
  background: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

/* Google Login Button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #ffffff;
  color: #374151;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn-google:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.google-icon {
  flex-shrink: 0;
}

/* Login Divider */
.login-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: #9ca3af;
  font-size: 14px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.login-divider span {
  padding: 0 16px;
}

.login-footer {
  margin-top: 24px;
  font-size: 14px;
}
.login-footer a {
  color: #6b7280;
  text-decoration: none;
  transition: color 0.2s;
}
.login-footer a:hover {
  color: #7c3aed;
  text-decoration: underline;
}

/* Checkboxy prawne */
.legal-checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.legal-checkbox-container input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #7c3aed;
}
.legal-text {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}
.legal-link {
  color: #7c3aed;
  text-decoration: none;
  font-weight: 500;
}
.legal-link:hover {
  text-decoration: underline;
}
.create-account {
  color: #7c3aed !important;
  font-weight: 600;
}

/* ============================================
   NOTEBOOK - Notes Rozwoju
   ============================================ */

/* Ikona notesu (trigger) */
.notebook-trigger {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.3s ease;
}
.notebook-trigger:hover {
  transform: translateY(-50%) scale(1.08);
}
.notebook-trigger:hover .notebook-icon-img {
  filter: drop-shadow(0 8px 20px rgba(124, 58, 237, 0.4));
}
.notebook-icon-img {
  width: 64px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(124, 58, 237, 0.25));
  transition: filter 0.3s ease;
}
.notebook-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  font-size: 11px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}
.notebook-label {
  font-size: 11px;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ============================================================================
   DZIENNIK ROZWOJU - NOWY DESIGN Z GRAFIKĄ
   ============================================================================ */

/* Animacja intro - ikona powiększa się na środek */
.notebook-intro {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(30, 20, 50, 0);
  transition: background 0.3s ease;
}
.notebook-intro.active {
  display: flex;
  background: rgba(30, 20, 50, 0.9);
}

.notebook-intro-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  transform: scale(1);
  opacity: 1;
  animation: notebookIconZoom 1.4s ease-out forwards;
}

@keyframes notebookIconZoom {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  85% {
    transform: scale(10);
    opacity: 1;
  }
  100% {
    transform: scale(11);
    opacity: 0;
  }
}

/* Animacja intro - Dziennik Snów */
.dreams-intro {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 12, 41, 0);
  transition: background 0.3s ease;
}
.dreams-intro.active {
  display: flex;
  background: rgba(15, 12, 41, 0.95);
}

.dreams-intro-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  transform: scale(1);
  opacity: 1;
  animation: dreamsIconZoom 1.4s ease-out forwards;
}

@keyframes dreamsIconZoom {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  85% {
    transform: scale(10);
    opacity: 1;
  }
  100% {
    transform: scale(11);
    opacity: 0;
  }
}

.notebook-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.notebook-overlay.active {
  display: flex;
}

.notebook-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 20, 50, 0.9);
  backdrop-filter: blur(10px);
}

.notebook-main {
  position: relative;
  z-index: 10;
  animation: notebookFadeIn 0.4s ease;
}
@keyframes notebookFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.notebook-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.3);
  border: none;
  color: white;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notebook-close:hover {
  background: rgba(0,0,0,0.5);
  transform: scale(1.1);
}

/* Kontener z grafiką */
.notebook-image-container {
  position: relative;
  width: 90vw;
  max-width: 750px;
  max-height: 85vh;
}

.notebook-bg-image {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.5));
}

/* Strony notesu - pozycjonowane na grafice */
.notebook-page {
  position: absolute;
  top: 12%;
  height: 70%;
  padding: 20px;
  overflow-y: auto;
}

.notebook-page-left {
  left: 8%;
  width: 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.notebook-page-right {
  right: 7%;
  width: 40%;
  display: flex;
  flex-direction: column;
}

.notebook-title {
  font-size: 22px;
  color: #2d0648;
  font-weight: 700;
  margin-bottom: 10px;
}

.notebook-subtitle {
  font-size: 14px;
  color: #6b7280;
  font-style: italic;
}

/* Lista przekonań */
.beliefs-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
}

/* Paginacja */
.notebook-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin-top: auto;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d4c5a9;
  background: white;
  color: #2d0648;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled) {
  background: #f3e8ff;
  border-color: #7c3aed;
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#page-number {
  font-size: 14px;
  color: #6b7280;
}

/* Mobile */
@media (max-width: 600px) {
  .notebook-image-container {
    width: 98vw;
  }
  .notebook-page {
    padding: 10px;
    top: 10%;
    height: 75%;
  }
  .notebook-page-left {
    display: none;
  }
  .notebook-page-right {
    left: 5%;
    right: 5%;
    width: 90%;
  }
  .notebook-title {
    font-size: 18px;
  }
}

/* Karta przekonania w notesie */
.belief-notebook-card {
  background: rgba(255,255,255,0.95);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid #e5e7eb;
  position: relative;
}
.belief-notebook-card:hover {
  transform: translateX(4px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* Typ przekonania - OGRANICZAJĄCE (limiting) */
.belief-notebook-card.type-limiting {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-left-color: #ef4444;
}

/* Typ przekonania - WSPIERAJĄCE (empowering) */
.belief-notebook-card.type-empowering {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-left-color: #10b981;
  border-left-width: 5px;
}
.belief-notebook-card.type-empowering .belief-notebook-text {
  color: #065f46;
}

/* Badge typu przekonania */
.belief-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 6px;
}
.belief-type-badge.limiting {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}
.belief-type-badge.empowering {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

/* Status pracy - dla limiting (legacy) */
.belief-notebook-card.type-limiting.status-discovered { border-left-color: #ef4444; }
.belief-notebook-card.type-limiting.status-in_progress { border-left-color: #f59e0b; }
.belief-notebook-card.type-limiting.status-understood { border-left-color: #3b82f6; }
.belief-notebook-card.type-limiting.status-released { border-left-color: #22c55e; }

/* NOWE STATUSY (Alchemia Umysłu) - dla empowering */
.belief-notebook-card.status-discovered { border-left-color: #f472b6; }  /* Różowy - odkryte */
.belief-notebook-card.status-practicing { border-left-color: #fbbf24; }  /* Złoty - praktykuję */
.belief-notebook-card.status-integrated { border-left-color: #22c55e; border-left-width: 5px; }  /* Zielony - zintegrowane */

/* Kolory dla empowering afirmacji */
.belief-notebook-card.type-empowering.status-discovered { 
  border-left-color: #f472b6; 
  background: linear-gradient(135deg, rgba(252, 231, 243, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
}
.belief-notebook-card.type-empowering.status-practicing { 
  border-left-color: #fbbf24; 
  background: linear-gradient(135deg, rgba(254, 249, 195, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
}
.belief-notebook-card.type-empowering.status-integrated { 
  border-left-color: #22c55e; 
  border-left-width: 6px;
  background: linear-gradient(135deg, rgba(220, 252, 231, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
}

/* Zakładki w notesie */
.notebook-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  border-bottom: 2px solid rgba(167, 139, 250, 0.2);
  padding-bottom: 5px;
}

.notebook-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  position: relative;
}

.notebook-tab:hover {
  color: #4b5563;
  background: rgba(0,0,0,0.03);
}

.notebook-tab.active {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
}

.notebook-tab.active::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 0;
  right: 0;
  height: 2px;
  background: #7c3aed;
  border-radius: 2px;
}

/* ============================================
   NOTEBOOK OVERLAY & STRUCTURE
   ============================================ */

.notebook-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.notebook-overlay.active {
  display: flex;
}

.notebook-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 20, 50, 0.9);
  backdrop-filter: blur(10px);
}

.notebook-main {
  position: relative;
  z-index: 10;
  animation: notebookFadeIn 0.4s ease;
}
@keyframes notebookFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.notebook-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.3);
  border: none;
  color: white;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notebook-close:hover {
  background: rgba(0,0,0,0.5);
  transform: scale(1.1);
}

/* Container with graphic */
.notebook-image-container {
  position: relative;
  width: 90vw;
  max-width: 750px;
  max-height: 85vh;
}

.notebook-bg-image {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.5));
}

/* Notebook pages - positioned on graphic */
.notebook-page {
  position: absolute;
  top: 12%;
  height: 70%;
  padding: 20px;
  overflow-y: auto;
}

.notebook-page-left {
  left: 8%;
  width: 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.notebook-page-right {
  right: 7%;
  width: 40%;
  display: flex;
  flex-direction: column;
}

.notebook-title {
  font-size: 22px;
  color: #2d0648;
  font-weight: 700;
  margin-bottom: 10px;
}

.notebook-subtitle {
  font-size: 14px;
  color: #6b7280;
  font-style: italic;
}

/* Beliefs list */
.beliefs-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
}

/* Pagination */
.notebook-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin-top: auto;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d4c5a9;
  background: white;
  color: #2d0648;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled) {
  background: #f3e8ff;
  border-color: #7c3aed;
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#page-number {
  font-size: 14px;
  color: #6b7280;
}

/* ============================================
   📱 MOBILE NOTEBOOK - FULLSCREEN DESIGN
   ============================================ */
@media (max-width: 600px) {
  /* Hide notebook graphic - show fullscreen card */
  .notebook-image-container {
    width: 100%;
    max-width: none;
  }
  
  .notebook-bg-image {
    display: none;
  }
  
  /* Container imitates notebook page */
  .notebook-image-container {
    background: linear-gradient(135deg, #fefdfb 0%, #f9f6f0 100%);
    border-radius: 20px;
    margin: 10px;
    width: calc(100% - 20px);
    min-height: 80vh;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 0;
  }
  
  /* Notebook pages - on mobile it's one full page */
  .notebook-page {
    position: relative;
    top: auto;
    height: auto;
    min-height: 70vh;
    padding: 24px 20px;
  }
  
  .notebook-page-left {
    display: none;
  }
  
  .notebook-page-right {
    position: relative;
    left: auto;
    right: auto;
    width: 100%;
    padding: 0;
  }
  
  /* "Truth about me" title */
  .notebook-section-title {
    font-size: 28px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(124, 58, 237, 0.2);
  }
  
  /* Beliefs list - full width, readable */
  .beliefs-list {
    width: 100%;
    max-height: none;
    overflow-y: visible;
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Truth card - bigger and more readable */
  .truth-card {
    width: 100%;
    margin-bottom: 16px;
    padding: 20px 18px;
    border-radius: 16px;
  }
  
  .truth-text {
    font-size: 22px;
    line-height: 1.4;
    margin-bottom: 12px;
  }
  
  .truth-meta {
    font-size: 13px;
  }
  
  .truth-status-dot {
    width: 10px;
    height: 10px;
  }
  
  /* Pagination - bigger buttons */
  .notebook-pagination {
    margin-top: 24px;
    padding: 16px 0;
    gap: 20px;
  }
  
  .notebook-pagination button {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  
  #page-number {
    font-size: 16px;
  }
  
  /* Close button */
  .notebook-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  
  /* Empty state */
  .notebook-empty-new {
    padding: 60px 20px;
  }
  
  .notebook-empty-new .empty-icon {
    font-size: 56px;
  }
  
  .notebook-empty-new .empty-text {
    font-size: 24px;
  }
}

/* ============================================
   NEW INSIGHT JOURNAL - "Truth about me"
   ============================================ */

/* Section title - like in a real journal */
.notebook-section-title {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 600;
  color: #4c1d95;
  text-align: left;
  margin-bottom: 16px;
  padding-left: 5px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.15);
  padding-bottom: 8px;
}

/* Truth Card - new design with handwriting */
.truth-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(252, 251, 255, 0.95) 100%);
  border-radius: 12px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(167, 139, 250, 0.15);
  position: relative;
  overflow: hidden;
}

.truth-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #a855f7, #7c3aed);
  border-radius: 4px 0 0 4px;
}

.truth-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.15);
  border-color: rgba(167, 139, 250, 0.3);
}

/* Truth text - handwriting */
.truth-text {
  font-family: 'Caveat', cursive;
  font-size: 24px;
  font-weight: 600;
  color: #4c1d95;
  line-height: 1.3;
  margin-bottom: 8px;
}

/* Meta information */
.truth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
}

.truth-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.truth-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
}

.truth-status.integrated .truth-status-dot {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* Empty journal state */
.notebook-empty-new {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

.notebook-empty-new .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.notebook-empty-new .empty-text {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: #6b7280;
  line-height: 1.4;
}

/* ============================================
   TRUTH DETAIL - Modal
   ============================================ */

.truth-detail-modal {
  background: white;
  border-radius: 20px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
}

/* Main truth (GOLD) */
.truth-detail-gold {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  color: #4c1d95;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.2;
  padding: 0 10px;
}

/* Old belief section */
.truth-detail-old-section {
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.truth-detail-old-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9ca3af;
  margin-bottom: 10px;
}

/* LEAD - crossed out by hand with navy pen (X on ALL text) */
.truth-detail-lead {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 500;
  color: #b0b0b0;
  position: relative;
  display: inline;
  /* Main strikethrough - covers ALL text on all lines */
  text-decoration: line-through;
  text-decoration-color: #1e3a5f;
  text-decoration-thickness: 1.5px;
  text-decoration-style: solid;
}

/* Second X line - at angle (for handwritten effect) */
.truth-detail-lead::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 55%;
  height: 1.5px;
  background: #1e3a5f;
  pointer-events: none;
  transform: rotate(-3deg);
  opacity: 0.5;
}

/* Fix (night mode): old belief text could become white-on-white due to global theme styles.
   Force readable contrast inside the white "Old belief" panel. */
[data-theme="night"] .truth-detail-old-section {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
}
[data-theme="night"] .truth-detail-old-label {
  color: #475569 !important;
}
[data-theme="night"] .truth-detail-lead {
  color: #334155 !important;
  -webkit-text-fill-color: #334155 !important;
}

/* "I want to go deeper" button */
.truth-deep-dive-btn {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.truth-deep-dive-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.truth-deep-dive-btn:active {
  transform: translateY(0);
}

/* Status in details */
.truth-detail-status {
  text-align: center;
  margin-bottom: 20px;
  font-size: 13px;
  color: #6b7280;
}

/* 📱 MOBILE - Truth detail modal */
@media (max-width: 600px) {
  .truth-detail-modal {
    width: 95%;
    max-width: none;
    padding: 24px 20px;
    border-radius: 16px;
    max-height: 90vh;
  }
  
  .truth-detail-gold {
    font-size: 28px;
    margin-bottom: 20px;
    padding: 0;
  }
  
  .truth-detail-old-section {
    padding: 16px;
    margin-bottom: 20px;
  }
  
  .truth-detail-lead {
    font-size: 20px;
  }
  
  .truth-deep-dive-btn {
    padding: 18px 24px;
    font-size: 16px;
    border-radius: 14px;
  }
  
  .truth-detail-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
}

/* LEGACY STYLES */
.belief-notebook-text {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}
/* Transformation source (Mind Alchemy) */
.belief-source-text {
  font-size: 11px;
  color: #9ca3af;
  font-style: italic;
  margin-bottom: 8px;
  padding-left: 12px;
  border-left: 2px solid #e5e7eb;
}
.belief-notebook-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
}
.belief-notebook-status {
  display: flex;
  align-items: center;
  gap: 6px;
}
.belief-notebook-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
/* Kolory statusów w tekście */
.status-discovered .belief-notebook-status { color: #ec4899; }  /* Różowy */
.status-practicing .belief-notebook-status { color: #d97706; }  /* Złoty */
.status-integrated .belief-notebook-status { color: #16a34a; }  /* Zielony */
/* Legacy */
.status-in_progress .belief-notebook-status { color: #d97706; }
.status-understood .belief-notebook-status { color: #3b82f6; }
.status-released .belief-notebook-status { color: #16a34a; }

/* Paginacja stron */
.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}
.page-turn {
  background: none;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #4b5563;
  transition: all 0.2s;
}
.page-turn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #7c3aed;
  color: #7c3aed;
}
.page-turn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-number {
  font-size: 14px;
  color: #6b7280;
}

/* Animacja przewracania kartki */
.book-page-turning {
  position: absolute;
  width: 400px;
  height: 550px;
  background: linear-gradient(135deg, #fffef9 0%, #f8f5e6 100%);
  transform-origin: left center;
  transform-style: preserve-3d;
  display: none;
  z-index: 10;
  left: 400px;
  border-radius: 0 8px 8px 0;
}
.book-page-turning.turning {
  display: block;
  animation: pageTurn 0.6s ease forwards;
}
@keyframes pageTurn {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-180deg); }
}

/* Overlay szczegółów przekonania */
.belief-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
}
.belief-detail-overlay.active {
  display: flex;
}
.belief-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.belief-detail-modal {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.belief-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f3f4f6;
  border: none;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}
.belief-detail-title {
  font-size: 20px;
  color: #1f2937;
  margin-bottom: 12px;
  padding-right: 40px;
}
.belief-detail-status {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.belief-detail-status.discovered { background: #fee2e2; color: #dc2626; }
.belief-detail-status.in_progress { background: #fef3c7; color: #d97706; }
.belief-detail-status.understood { background: #dbeafe; color: #2563eb; }
.belief-detail-status.released { background: #d1fae5; color: #059669; }

.belief-detail-source {
  color: #6b7280;
  font-style: italic;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}
.belief-detail-progress {
  max-height: 300px;
  overflow-y: auto;
}
.progress-entry {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 10px;
}
.progress-date {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 4px;
}
.progress-note {
  font-size: 14px;
  color: #374151;
}

/* Pusty notes */
.notebook-empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}
.notebook-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.notebook-empty-text {
  font-size: 15px;
  line-height: 1.6;
}

/* Responsywność */
@media (max-width: 900px) {
  .book {
    width: 100%;
    max-width: 400px;
    flex-direction: column;
    height: auto;
  }
  .book-page {
    width: 100%;
    height: auto;
    min-height: 400px;
  }
  .book-page-left {
    display: none;
  }
  .notebook-trigger {
    right: 12px;
    top: auto;
    bottom: 100px;
    transform: none;
  }
  .notebook-trigger:hover {
    transform: scale(1.1);
  }
}

/* Animacja notyfikacji */
@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ============================================================================
   DZIENNIK SNÓW
   ============================================================================ */

.dreams-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.dreams-overlay.active {
  display: flex;
}

.dreams-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(196, 181, 253, 0.22) 0%, rgba(10, 3, 24, 0.92) 55%, rgba(10, 3, 24, 0.96) 100%);
  opacity: 1;
}

.dreams-container {
  position: relative;
  width: 95%;
  max-width: 760px;
  max-height: 90vh;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 100%);
  border: 1px solid var(--violet-border, rgba(196, 181, 253, 0.2));
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.5),
    0 0 120px rgba(124, 58, 237, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  animation: dreamFadeIn 0.5s ease;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

@keyframes dreamFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.dreams-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 32px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
  width: auto;
  height: auto;
}
.dreams-close:hover {
  color: #fff;
  background: none;
  transform: none;
}

.dreams-content {
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
}

.dreams-header {
  text-align: center;
  margin-bottom: 24px;
}
.dreams-header h2 {
  color: var(--text-soul, #fff);
  font-size: 30px;
  margin-bottom: 8px;
  font-family: var(--font-soul, 'Playfair Display', Georgia, serif);
  font-weight: 500;
  letter-spacing: 0.2px;
  text-shadow: 0 2px 24px rgba(124, 58, 237, 0.35);
}
.dreams-header p {
  color: var(--text-whisper, rgba(255, 255, 255, 0.75));
  font-size: 14px;
}

/* Tabs */
.dreams-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.dreams-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-ghost, rgba(255, 255, 255, 0.6));
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  width: auto;
  height: auto;
}
.dreams-tab:hover {
  color: var(--text-soul, #fff);
  background: rgba(255, 255, 255, 0.1);
  transform: none;
}
.dreams-tab.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 55%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.25);
}

.dreams-tab-content {
  display: none;
}
.dreams-tab-content.active {
  display: block;
  animation: tabFadeIn 0.3s ease;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Form nowego snu */
.dream-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.dream-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dream-field label {
  color: var(--text-whisper, rgba(255, 255, 255, 0.85));
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dream-field input,
.dream-field textarea {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text-soul, #fff);
  font-size: 15px;
  font-family: var(--font-human, 'Inter', system-ui, sans-serif);
  transition: all 0.2s;
}
.dream-field input:focus,
.dream-field textarea:focus {
  outline: none;
  border-color: rgba(196, 181, 253, 0.55);
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}
.dream-field textarea {
  resize: vertical;
  min-height: 120px;
}
.dream-field input::placeholder,
.dream-field textarea::placeholder {
  color: rgba(243, 232, 255, 0.45);
}

.dream-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dream-field input[type="range"] {
  padding: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
}
.dream-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: pointer;
}
#intensity-value {
  color: #667eea;
  font-weight: 700;
  margin-left: 8px;
}

.dream-submit {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 55%, #6366f1 100%);
  border: none;
  padding: 16px 24px;
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  width: 100%;
  height: auto;
  box-shadow: 0 18px 50px rgba(124, 58, 237, 0.28);
}
.dream-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 60px rgba(124, 58, 237, 0.35);
}
.dream-submit:disabled {
  opacity: 1;
  cursor: wait;
  transform: none;
}

/* Animacja myślenia w przycisku dziennika snów */
.dream-thinking {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.dream-thinking .thinking-dots {
  display: flex;
  gap: 4px;
}
.dream-thinking .thinking-dots span {
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  animation: dreamDot 1.2s infinite ease-in-out;
}
.dream-thinking .thinking-dots span:nth-child(1) { animation-delay: 0s; }
.dream-thinking .thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.dream-thinking .thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dreamDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Lista snów */
.dreams-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dream-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.dream-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(196, 181, 253, 0.35);
  transform: translateY(-1px);
}
.dream-card-title {
  color: var(--text-soul, #fff);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dream-card-title .recurring-badge {
  background: #f59e0b;
  color: #000;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}
.dream-card-date {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  margin-bottom: 8px;
}
.dream-card-preview {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dream-card-themes {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.theme-tag {
  background: rgba(102, 126, 234, 0.2);
  color: #a5b4fc;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
}

.dreams-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.5);
}
.dreams-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Symbole */
.symbols-intro {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 20px;
  text-align: center;
}
.symbols-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.symbol-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.symbol-name {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: capitalize;
}
.symbol-count {
  color: #667eea;
  font-size: 24px;
  font-weight: 700;
}
.symbol-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

/* Day theme fixes: Symbols tab readability (white-on-white bug) */
[data-theme="day"] .symbols-intro {
  color: rgba(45, 6, 72, 0.70);
}
[data-theme="day"] .symbol-card {
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.14);
}
[data-theme="day"] .symbol-name {
  color: #2d0648;
}
[data-theme="day"] .symbol-label {
  color: rgba(45, 6, 72, 0.55);
}
[data-theme="day"] .symbol-count {
  color: #4f46e5;
}

/* Szczegóły snu */
.dream-detail {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  padding: 32px;
  overflow-y: auto;
  z-index: 5;
}
.dream-detail.hidden {
  display: none;
}
.dream-detail-back {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  margin-bottom: 20px;
  width: auto;
  height: auto;
  font-size: 14px;
}
.dream-detail-back:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: none;
}
.dream-detail-content h3 {
  color: #fff;
  font-size: 24px;
  margin-bottom: 8px;
}
.detail-date {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  margin-bottom: 24px;
}
.detail-section {
  margin-bottom: 24px;
}
.detail-section h4 {
  color: #a5b4fc;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.detail-section p {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
}
.detail-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.detail-symbol {
  background: rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
}
.detail-symbol-name {
  color: #fff;
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-symbol-meaning {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

/* Mobile */
@media (max-width: 600px) {
  .dreams-content {
    padding: 20px;
  }
  .dreams-header h2 {
    font-size: 22px;
  }
  .dreams-tabs {
    flex-direction: column;
  }
  .dream-field-row {
    grid-template-columns: 1fr;
  }
  .symbols-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   ANIMACJA "SULENAI MYŚLI" - Premium Loader
   ============================================ */

.thinking-msg {
  animation: thinkingFadeIn 0.5s ease-out forwards;
}

@keyframes thinkingFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pulsująca poświata wokół avatara */
.thinking-avatar {
  position: relative;
}

.thinking-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.5) 0%, transparent 70%);
  z-index: -1;
}

/* Osobna reguła dla animacji - lepiej działa */
.thinking-msg .thinking-glow {
  animation: thinkingPulse 1.8s ease-in-out infinite;
}

@keyframes thinkingPulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 0.5; 
  }
  50% { 
    transform: scale(1.4); 
    opacity: 0.2; 
  }
}

/* Bańka z myśleniem - minimalistyczna bez ramki */
.thinking-bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  min-width: 160px;
}

.thinking-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
}

/* Animowane kropki */
.thinking-dots {
  display: flex;
  gap: 6px;
}

.thinking-dots span {
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.6);
  display: inline-block;
}

/* Animacja na osobnej regule */
.thinking-msg .thinking-dots span {
  animation: thinkingDot 1.2s ease-in-out infinite;
}

.thinking-msg .thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-msg .thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-msg .thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkingDot {
  0%, 100% { 
    transform: scale(0.7);
    opacity: 0.4;
  }
  50% { 
    transform: scale(1.3);
    opacity: 1;
  }
}

/* Tekst "Sulenai myśli..." */
.thinking-text {
  font-size: 13px;
  color: #a78bfa;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.thinking-msg .thinking-text {
  animation: thinkingTextFade 2s ease-in-out infinite;
}

@keyframes thinkingTextFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ==================== USTAWIENIA ==================== */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.settings-overlay.active {
  display: flex;
}
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 6, 72, 0.5);
  backdrop-filter: blur(4px);
}
.settings-container {
  position: relative;
  width: 90%;
  max-width: 280px;
  max-height: 85vh;
  background: white;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(124, 58, 237, 0.3);
  animation: settingsFadeIn 0.2s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes settingsFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Nagłówek z avatarem */
.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid #f3e8ff;
}
.settings-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  color: white;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.settings-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-name {
  font-size: 15px;
  font-weight: 600;
  color: #2d0648;
}
.settings-email {
  font-size: 13px;
  color: #9ca3af;
}

/* Lista opcji */
.settings-list {
  padding: 8px;
}
.settings-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 12px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.settings-option:hover {
  background: #faf5ff;
}
.settings-option span {
  font-size: 15px;
  color: #374151;
  font-weight: 500;
}
.settings-icon {
  width: 22px;
  height: 22px;
  color: #7c3aed;
  flex-shrink: 0;
}
.settings-divider {
  height: 1px;
  background: #f3e8ff;
  margin: 4px 12px;
}

/* Rozmiar czcionki w ustawieniach */
.settings-font-size {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 4px 0;
}
.font-size-label {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #4b5563;
  font-size: 15px;
}
.font-size-label .settings-icon {
  width: 22px;
  height: 22px;
  color: #7c3aed;
}
.font-size-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.font-size-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e9d5ff;
  background: #faf5ff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.2s;
}
.font-size-btn:hover {
  background: #f3e8ff;
  border-color: #d8b4fe;
}
.font-size-btn:active {
  transform: scale(0.95);
}
.font-size-value {
  min-width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
}

/* Language Selector in Preferences */
.language-selector {
  display: flex;
  gap: 8px;
}
.lang-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid #e9d5ff;
  border-radius: 10px;
  background: #faf5ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.2s ease;
}
.lang-choice img {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.lang-choice:hover {
  border-color: #d8b4fe;
  background: #f3e8ff;
  color: #7c3aed;
}
.lang-choice.active {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ==================== PREFERENCJE ==================== */
.preferences-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.preferences-overlay.active {
  display: flex;
}
.preferences-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}
.preferences-container {
  position: relative;
  width: 92%;
  max-width: 400px;
  max-height: 85vh;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}
.preferences-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}
.preferences-close:hover {
  background: #e5e7eb;
  color: #374151;
}
.preferences-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #f3e8ff;
}
.preferences-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #2d0648;
  margin: 0 0 4px 0;
}
.preferences-header p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}
.preferences-list {
  padding: 16px;
}
.preferences-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #faf5ff;
  border-radius: 12px;
  margin-bottom: 12px;
}
.preferences-item:last-child {
  margin-bottom: 0;
}
.preferences-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.preferences-icon {
  width: 24px;
  height: 24px;
  color: #7c3aed;
  flex-shrink: 0;
}
.preferences-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.preferences-item-title {
  font-size: 15px;
  font-weight: 600;
  color: #2d0648;
}
.preferences-item-desc {
  font-size: 12px;
  color: #6b7280;
}

/* ==================== PROFIL ==================== */
.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
}
.profile-overlay.active {
  display: flex;
}
.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 6, 72, 0.6);
  backdrop-filter: blur(6px);
}
.profile-container {
  position: relative;
  width: 92%;
  max-width: 400px;
  max-height: 85vh;
  background: white;
  border-radius: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 25px 50px -12px rgba(124, 58, 237, 0.3);
  animation: profileSlideIn 0.25s ease;
}
@keyframes profileSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.profile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s;
}
.profile-close:hover {
  background: white;
  color: #2d0648;
}

/* Nagłówek profilu */
.profile-header {
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  padding: 32px 24px 24px;
  text-align: center;
}
.profile-avatar-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.profile-avatar span {
  font-size: 32px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.profile-avatar-edit:hover {
  transform: scale(1.1);
}
.profile-avatar-edit svg {
  width: 14px;
  height: 14px;
  color: #7c3aed;
}
.profile-avatar-remove {
  position: absolute;
  top: 0;
  right: -4px;
  width: 24px;
  height: 24px;
  background: #ef4444;
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s, background 0.2s;
  padding: 0;
}
.profile-avatar-remove:hover {
  transform: scale(1.1);
  background: #dc2626;
}
.profile-avatar-remove svg {
  width: 12px;
  height: 12px;
  color: white;
}
.profile-name-display {
  font-size: 20px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}
.profile-status {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}


/* Pola profilu */
.profile-fields {
  padding: 8px 0;
}
.profile-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #f3f4f6;
}
.profile-field:last-child {
  border-bottom: none;
}
.profile-field-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-field-label {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.profile-field-value {
  font-size: 15px;
  color: #1f2937;
  font-weight: 500;
}
.profile-field-placeholder {
  color: #9ca3af;
  font-style: italic;
}
.profile-field-btn {
  padding: 8px 16px;
  border: none;
  background: #f3e8ff;
  color: #7c3aed;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-field-btn:hover {
  background: #7c3aed;
  color: white;
}

.profile-divider {
  height: 1px;
  background: #f3e8ff;
  margin: 8px 24px;
}

/* Sekcja niebezpieczna */
.profile-danger-zone {
  padding: 16px 0 8px;
  border-top: 1px solid #fee2e2;
  margin-top: 8px;
}
.profile-danger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.profile-danger-item:hover {
  background: #fef2f2;
}
.profile-danger-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  padding-right: 16px;
}
.profile-danger-title {
  font-size: 14px;
  color: #dc2626;
  font-weight: 500;
}
.profile-danger-warning {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
}
.profile-danger-icon {
  width: 20px;
  height: 20px;
  color: #dc2626;
  flex-shrink: 0;
  opacity: 0.6;
}
.profile-danger-delete:hover {
  background: #fee2e2;
}
.profile-danger-delete .profile-danger-title {
  color: #b91c1c;
  font-weight: 600;
}

/* Modal edycji */
.profile-edit-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.profile-edit-modal.active {
  display: flex;
}
.profile-edit-content {
  width: 100%;
  max-width: 300px;
}
.profile-edit-content h3 {
  font-size: 18px;
  color: #2d0648;
  margin: 0 0 16px;
  text-align: center;
}
/* Password toggle wrapper */
.password-input-wrapper {
  position: relative;
  width: 100%;
}
.password-input-wrapper .profile-edit-input {
  padding-right: 48px;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #a1a1aa;
  transition: color 0.2s;
}
.password-toggle:hover {
  color: #7c3aed;
}
.password-toggle svg {
  width: 20px;
  height: 20px;
}

.profile-edit-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e9d5ff;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.profile-edit-input:focus {
  border-color: #7c3aed;
}
.profile-edit-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.profile-edit-cancel,
.profile-edit-save {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-edit-cancel {
  background: #f3f4f6;
  color: #6b7280;
}
.profile-edit-cancel:hover {
  background: #e5e7eb;
}
.profile-edit-save {
  background: #7c3aed;
  color: white;
}
.profile-edit-save:hover {
  background: #6d28d9;
}

/* Modal potwierdzenia */
.profile-confirm-content {
  text-align: center;
}
.profile-confirm-icon {
  font-size: 48px;
  margin-bottom: 8px;
}
.profile-confirm-message {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin: 12px 0 0;
}
.profile-confirm-danger {
  background: #dc2626 !important;
}
.profile-confirm-danger:hover {
  background: #b91c1c !important;
}

/* ========================================
   🔄 BANNER AKTUALIZACJI
======================================== */
#update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}
#update-banner.visible {
  transform: translateY(0);
}
.update-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  max-width: 600px;
  margin: 0 auto;
}
.update-icon {
  font-size: 20px;
  animation: spin 2s linear infinite;
}
.update-text {
  color: white;
  font-size: 14px;
  font-weight: 500;
}
.update-btn {
  background: white;
  color: #7c3aed;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.update-btn:hover {
  background: #f3e8ff;
  transform: scale(1.05);
}
.update-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 24px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}
.update-close:hover {
  color: white;
}

/* Disclaimer w chacie */
.chat-disclaimer {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 8px 0 4px 0;
  opacity: 0.7;
}

@media (max-width: 480px) {
  .update-banner-content {
    padding: 10px 12px;
    gap: 8px;
  }
  .update-text {
    font-size: 12px;
  }
  .update-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ========================================
   📱 MOBILE CHAT - STYL WHATSAPP
   Wiadomości na pełną szerokość ekranu
======================================== */
@media (max-width: 768px) {
  /* Chat - minimalne marginesy na bokach */
  #chat {
    padding: 12px 8px 120px 8px;
  }
  
  /* Wiadomości - mniejszy gap między avatarem a tekstem */
  .msg {
    gap: 8px;
    margin-bottom: 16px;
  }
  
  /* Bąbelki - prawie pełna szerokość */
  .bubble {
    max-width: 92%;
    /* font-size kontrolowany przez ustawienia użytkownika */
  }
  
  .bubble-me {
    padding: 12px 16px;
    border-radius: 20px;
    border-bottom-right-radius: 4px;
  }
  
  .bubble-bot {
    padding: 4px 0 0 0;
  }
  
  /* Avatary - mniejsze na mobile */
  .bot-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
  .bot-avatar img {
    width: 20px;
    height: 20px;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
  .user-avatar-letter {
    font-size: 13px;
  }
  
  /* Input bar - mniejsze marginesy */
  .input-bar {
    padding: 12px 8px 20px 8px;
  }
  
  /* Header - kompaktowy */
  header {
    padding: 12px 12px;
  }
}

/* Jeszcze mniejsze ekrany (< 480px) */
@media (max-width: 480px) {
  #chat {
    padding: 8px 6px 110px 6px;
  }
  
  .msg {
    gap: 6px;
    margin-bottom: 12px;
  }
  
  .bubble {
    max-width: 94%;
    /* font-size kontrolowany przez ustawienia użytkownika */
    line-height: 1.5;
  }
  
  .bubble-me {
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
  }
  
  /* Jeszcze mniejsze avatary */
  .bot-avatar,
  .user-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
  .bot-avatar img {
    width: 18px;
    height: 18px;
  }
  .user-avatar-letter {
    font-size: 11px;
  }
  
  .input-bar {
    padding: 10px 6px 16px 6px;
  }
}

/* ========================================
   🔐 PASSWORD STRENGTH VALIDATION
======================================== */

.password-strength-container {
  margin-top: 8px;
}

.password-strength-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.password-strength-fill {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.password-strength-fill.weak { width: 25%; background: #ef4444; }
.password-strength-fill.fair { width: 50%; background: #f59e0b; }
.password-strength-fill.good { width: 75%; background: #3b82f6; }
.password-strength-fill.strong { width: 100%; background: #22c55e; }

.password-requirements {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  padding: 0;
  list-style: none;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  transition: color 0.2s;
}

.password-requirements li::before {
  content: '○';
  color: #d1d5db;
  font-size: 10px;
}

.password-requirements li.valid {
  color: #22c55e;
}

.password-requirements li.valid::before {
  content: '✓';
  color: #22c55e;
}

.password-requirements li.invalid {
  color: #ef4444;
}

.password-strength-text {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  margin-bottom: 4px;
}

.password-strength-text.weak { color: #ef4444; }
.password-strength-text.fair { color: #f59e0b; }
.password-strength-text.good { color: #3b82f6; }
.password-strength-text.strong { color: #22c55e; }

/* ======================================================================
   SULENAI CHAT — ETHEREAL GLASSMORPHISM + PREMIUM MINIMALISM (OVERRIDES)
   Scope: VISUAL ONLY. No JS/streaming/backend changes.
   Inspiration: Home "Luminous Silence" — #FDFCFD + subtle noise + glass.
======================================================================== */
:root {
  --bg-luminous: #FDFCFD;
  --text-graphite: #1a1a1e;
  --text-secondary: #5c5c5c;
  --text-muted: #9a9a9a;
  --accent-violet: #7c6f9c;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --glass-border: rgba(0, 0, 0, 0.06);
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 18px 70px rgba(0, 0, 0, 0.10);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
  background: var(--bg-luminous) !important;
  color: var(--text-graphite) !important;
}

/* Subtle noise (same spirit as Home) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: multiply;
}

.page {
  max-width: none !important;
  margin: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

header {
  background: rgba(253, 252, 253, 0.82) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}

.brand-title {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-weight: 400 !important;
  letter-spacing: -0.02em !important;
  color: var(--text-graphite) !important;
}

#chat {
  background:
    radial-gradient(900px 520px at 50% 5%, rgba(124, 111, 156, 0.10), transparent 60%),
    radial-gradient(600px 420px at 18% 40%, rgba(180, 160, 240, 0.08), transparent 55%),
    radial-gradient(700px 480px at 85% 55%, rgba(200, 220, 255, 0.08), transparent 55%),
    var(--bg-luminous);
}

#chat {
  /* Keep conversation in a premium readable column (prevents “drifting apart” on desktop) */
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 18px 240px 18px !important;
}
@media (max-width: 1100px) { #chat { max-width: 980px; padding: 24px 16px 220px 16px !important; } }
@media (max-width: 720px)  { #chat { max-width: 100%; padding: 18px 10px 220px 10px !important; } }

.msg { gap: 6px !important; width: 100% !important; }
.msg.bot { justify-content: flex-start !important; }
.msg.me { justify-content: flex-end !important; }
.msg.bot .bubble,
.msg.bot .stream-bubble { margin-right: auto !important; }
.msg.me .bubble { margin-left: auto !important; }
.bubble {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
  line-height: 1.85 !important;
  letter-spacing: -0.005em !important;
}

/* User bubble: ultra-minimal, subtle tint */
.bubble-me {
  background: rgba(26, 26, 30, 0.05) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  color: var(--text-graphite) !important;
  border-bottom-right-radius: 22px !important;
  border-bottom-left-radius: 22px !important;
  border-top-left-radius: 22px !important;
  border-top-right-radius: 8px !important;
}

/* Sulenai bubble: glass */
.bubble-bot,
.stream-bubble {
  padding: 16px 18px !important;
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 26px !important;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft);
  color: var(--text-graphite) !important;
}

.bot-avatar,
.user-avatar {
  background: rgba(255,255,255,0.62) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
}

/* Floating input: glass pill hovering above bottom */
.input-bar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: transparent !important;
  padding: 0 14px calc(14px + env(safe-area-inset-bottom)) 14px !important;
  z-index: 1000 !important;
}
.input-inner {
  /* Container should NOT be a pill; only the input row should. */
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}
.input-row {
  padding: 10px 10px !important;
  align-items: center !important;
  overflow: hidden !important; /* keeps send button inside pill on mobile */
  border-radius: 999px !important;
  /* White pill ONLY around the textarea row */
  background: rgba(255, 255, 255, 0.86) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    0 26px 90px rgba(124, 111, 156, 0.18),
    0 10px 34px rgba(0, 0, 0, 0.06);
}
.input-form { min-width: 0 !important; align-items: center !important; }

#input {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
  color: var(--text-graphite) !important;
  background: transparent !important;
  min-width: 0 !important;
}
#input::placeholder { color: rgba(26,26,30,0.45) !important; }

.send-btn {
  background: rgba(26,26,30,0.92) !important;
  color: var(--bg-luminous) !important;
  border-radius: 999px !important;
  flex-shrink: 0 !important;
  transition: transform 0.25s var(--ease-out-expo), box-shadow 0.25s var(--ease-out-expo);
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(0,0,0,0.18); }

.menu-toggle span { background: rgba(26,26,30,0.55) !important; }

.chat-disclaimer { color: rgba(26,26,30,0.45) !important; }
/* Avoid duplicate disclaimer text (keep the one inside the input area) */
.medical-disclaimer { display: none !important; }
/* Place disclaimer OUTSIDE the white pill */
.chat-disclaimer {
  margin-top: 8px !important;
  background: transparent !important;
}

/* Glass popup menu */
.input-menu {
  /* Even darker for visibility (requested) */
  background: rgba(214, 208, 226, 0.96) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 18px !important;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-elevated);
}
.menu-icon-img{
  width: 20px !important;
  height: 20px !important;
  opacity: 1 !important;
  filter: none !important;
}

/* Thinking indicator: no bubble, tucked to avatar */
.thinking-msg { gap: 10px !important; }
.thinking-bubble {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
.thinking-container { padding: 0 !important; }
.thinking-text { margin-top: 0 !important; }
.menu-item {
  border-radius: 14px !important;
}
.menu-item:hover {
  background: rgba(124, 111, 156, 0.08) !important;
}
.menu-icon-svg {
  width: 18px !important;
  height: 18px !important;
  color: rgba(26,26,30,0.65) !important;
}
.menu-icon-img{
  width: 20px !important;
  height: 20px !important;
  opacity: 1 !important;
  filter: none !important;
}
.menu-badge {
  background: rgba(26,26,30,0.08) !important;
  color: rgba(26,26,30,0.75) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
}

/* Dreams overlay: match icons we injected */
.dreams-title-icon,
.dreams-tab-icon,
.dream-submit-icon,
.detail-icon,
.profile-confirm-icon svg {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  margin-right: 10px;
  color: rgba(26,26,30,0.65);
}
.dreams-tab-icon { margin-right: 8px; }
.dream-submit-icon { margin-right: 10px; }
.detail-icon { width: 16px; height: 16px; margin-right: 8px; vertical-align: -2px; }
.profile-confirm-icon svg { width: 40px; height: 40px; margin: 0; color: rgba(26,26,30,0.55); }