/* ==========================================================
   Luna — para mi amor
   Estética: minimalista, premium, suave, emocional
   ========================================================== */

:root {
  --bg-1: #fdf6f9;
  --bg-2: #f5e9f1;
  --ink: #2b1d2a;
  --ink-soft: #6b5a68;
  --accent: #b86b8a;
  --accent-deep: #8a3f63;
  --gold: #c9a36a;
  --card: rgba(255, 255, 255, 0.65);
  --card-border: rgba(255, 255, 255, 0.8);
  --shadow: 0 20px 60px rgba(138, 63, 99, 0.18);
  --radius: 22px;
  --ease: cubic-bezier(.22,.9,.32,1);
}

/* Tema por momento del día */
body[data-time="morning"] {
  --bg-1: #fff6ec;
  --bg-2: #ffe7d6;
  --accent: #e08a5b;
  --accent-deep: #b25a2f;
  --ink: #3b2519;
}
body[data-time="afternoon"] {
  --bg-1: #fdf6f9;
  --bg-2: #f1dce9;
  --accent: #b86b8a;
  --accent-deep: #8a3f63;
  --ink: #2b1d2a;
}
body[data-time="evening"] {
  --bg-1: #efe6f5;
  --bg-2: #d8c8e6;
  --accent: #8a6bb8;
  --accent-deep: #5e3f8a;
  --ink: #1f1a2b;
}
body[data-time="night"] {
  --bg-1: #1a1530;
  --bg-2: #0f0b1f;
  --ink: #f1e8ff;
  --ink-soft: #b9a9d6;
  --accent: #c9a36a;
  --accent-deep: #ffd9a3;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* Reset suave */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 80% -10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, var(--bg-2), transparent 50%),
    linear-gradient(180deg, var(--bg-1), var(--bg-1));
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 1.2s var(--ease), color 0.6s var(--ease);
  -webkit-font-smoothing: antialiased;
}

#bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

.hidden { display: none !important; }

/* ==================== Onboarding ==================== */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
}
.onboarding-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 2.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 420px;
  width: 100%;
  animation: floatIn 0.9s var(--ease);
}
.onboarding-card .moon { font-size: 3rem; }
.onboarding-card h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.8rem;
  margin: 0.4rem 0 0.6rem;
}
.onboarding-card p { color: var(--ink-soft); margin-bottom: 1.4rem; }
.onboarding-card input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.7);
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.onboarding-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184,107,138,0.18);
}

/* ==================== App layout ==================== */
.app {
  position: relative; z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.2rem 1.4rem 6rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: floatIn 1s var(--ease);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0 1.5rem;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
}
.brand-mark {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 8px rgba(201,163,106,0.4));
}
.brand-name { font-style: italic; color: var(--accent-deep); }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.icon-btn:hover {
  background: var(--card);
  border-color: var(--card-border);
}
.icon-btn:active { transform: scale(0.94); }

/* Hero / frase del día */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 1.2rem 0.4rem 0.8rem;
}
.greeting {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  letter-spacing: 0.4px;
  animation: fadeUp 0.8s var(--ease) 0.1s both;
}
.phrase {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 4.2vw, 2.1rem);
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: 0.2px;
  max-width: 22ch;
  margin: 0 auto;
  animation: fadeUp 0.9s var(--ease) 0.25s both;
}
.phrase::before, .phrase::after {
  content: '';
  display: inline-block;
  vertical-align: middle;
}
.phrase-context {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-style: italic;
  animation: fadeUp 0.9s var(--ease) 0.45s both;
  min-height: 1.2em;
}

/* Acciones */
.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-top: 0.9rem;
  animation: fadeUp 0.9s var(--ease) 0.6s both;
}
.action {
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
}
.action:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(138, 63, 99, 0.12);
}
.action:active { transform: scale(0.98); }
.action-icon {
  font-size: 1.05rem;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  flex-shrink: 0;
}
body[data-time="night"] .action-icon { background: rgba(255,255,255,0.08); }

.action-primary {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: none;
  color: white;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 14px 32px rgba(138, 63, 99, 0.28);
}
.action-primary .action-icon {
  background: rgba(255,255,255,0.18);
  color: white;
}
.action-primary:hover { box-shadow: 0 20px 40px rgba(138, 63, 99, 0.34); }

/* Footer informativo */
.bottom {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.4px;
  opacity: 0.85;
}
.bottom .dot { margin: 0 0.4rem; opacity: 0.5; }

/* ==================== Botones globales ==================== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  border: none;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(138, 63, 99, 0.28);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(138, 63, 99, 0.34); }
.btn-primary:active { transform: scale(0.97); }

.btn-soft {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--ink);
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.2s, transform 0.2s;
}
.btn-soft:hover { transform: translateY(-1px); }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(200, 60, 60, 0.4);
  color: #c83c3c;
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.btn-danger:hover { background: rgba(200, 60, 60, 0.08); }

/* ==================== Panels (modales) ==================== */
.panel {
  position: fixed; inset: 0;
  z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 12, 24, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s var(--ease);
  padding: 0;
}
@media (min-width: 720px) {
  .panel { align-items: center; padding: 2rem; }
}
.panel-card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 28px 28px 0 0;
  padding: 1.6rem 1.4rem 2rem;
  box-shadow: var(--shadow);
  animation: slideUp 0.35s var(--ease);
  border-top: 1px solid var(--card-border);
  position: relative;
}
@media (min-width: 720px) {
  .panel-card { border-radius: 24px; border: 1px solid var(--card-border); }
}
.panel-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-right: 2rem;
}
.panel-body {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 1.2rem;
}
.panel-body p { margin-bottom: 0.9rem; }
.panel-body .quote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.3rem;
  color: var(--accent-deep);
  text-align: center;
  padding: 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,0.4);
  border-radius: 6px;
  margin: 1rem 0;
}
body[data-time="night"] .panel-body .quote { background: rgba(255,255,255,0.04); }
.panel-footer {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.icon-btn.close {
  position: absolute;
  top: 0.8rem; right: 0.8rem;
}

/* ==================== Chat ==================== */
.chat-card {
  display: flex;
  flex-direction: column;
  height: min(720px, 92dvh);
  padding: 0;
}
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
body[data-time="night"] .chat-header { border-color: rgba(255,255,255,0.08); }
.chat-title { display: flex; align-items: center; gap: 0.7rem; }
.chat-avatar {
  font-size: 1.3rem;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  filter: drop-shadow(0 4px 8px rgba(138, 63, 99, 0.3));
}
.chat-title strong { display: block; font-weight: 600; }
.chat-title small { color: var(--ink-soft); font-size: 0.78rem; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}
.msg {
  max-width: 82%;
  padding: 0.7rem 1rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  animation: bubbleIn 0.35s var(--ease);
  word-wrap: break-word;
}
.msg.luna {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  border-bottom-right-radius: 4px;
}
.msg.typing {
  display: inline-flex; gap: 4px;
  padding: 0.9rem 1rem;
}
.msg.typing span {
  width: 6px; height: 6px;
  background: var(--ink-soft);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }

.chat-form {
  display: flex; gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: var(--bg-1);
}
body[data-time="night"] .chat-form { border-color: rgba(255,255,255,0.08); }
.chat-form input {
  flex: 1;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
}
body[data-time="night"] .chat-form input {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: var(--ink);
}
.chat-form input:focus { border-color: var(--accent); }
.chat-form .btn-primary {
  width: 44px; height: 44px;
  padding: 0;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}

/* ==================== Settings ==================== */
.field {
  display: block;
  margin-bottom: 1.4rem;
}
.field > span {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
}
.field input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
}
body[data-time="night"] .field input[type="text"] {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}
.field .hint {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}
.row {
  display: flex; gap: 0.5rem;
  margin-top: 0.6rem;
}
.row input { flex: 1; }

.spouse-list {
  list-style: none;
  margin-bottom: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}
.spouse-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.spouse-list li button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #c83c3c;
  font-size: 1rem;
  padding: 0 0.3rem;
}

/* ==================== Animations ==================== */
@keyframes floatIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================
   AyN — features avanzadas
   ========================================================== */

/* Countdown / fecha especial */
.countdown {
  margin: 1.2rem auto 0;
  padding: 0.9rem 1.2rem;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-align: left;
  font-size: 0.92rem;
  color: var(--ink);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.countdown.hidden { display: none; }
.countdown .cd-days {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--accent-deep);
  line-height: 1;
}
.countdown .cd-label {
  flex: 1;
  color: var(--ink-soft);
  line-height: 1.3;
}
.countdown strong { color: var(--accent-deep); }

/* Inline link en context */
.inline-link {
  color: var(--accent-deep);
  text-decoration: underline;
  font-weight: 500;
}

/* Respiración guiada */
.breath-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.breath-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0 1rem;
}
.breath-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    var(--accent), var(--accent-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  letter-spacing: 1px;
  box-shadow: 0 20px 50px rgba(138, 63, 99, 0.32);
  transform: scale(1);
  transition: transform 4s var(--ease), box-shadow 4s var(--ease);
}
.breath-circle.inhale {
  transform: scale(1.35);
  transition: transform 4s var(--ease);
}
.breath-circle.hold {
  transform: scale(1.35);
  transition: transform 4s linear;
}
.breath-circle.exhale {
  transform: scale(0.85);
  transition: transform 6s var(--ease);
}
.breath-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* Carta */
.letter-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.4rem 0.2rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--ink);
}
.letter-body p {
  margin: 0 0 0.9em;
}

/* Diario calendario */
.diary-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-top: 0.8rem;
}
.diary-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: rgba(0,0,0,0.5);
  font-weight: 500;
  background: rgba(255,255,255,0.45);
}
.diary-cell.empty {
  background: rgba(255,255,255,0.25);
  color: rgba(0,0,0,0.25);
}
.diary-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.legend-item i {
  width: 12px; height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* Lista "recuérdame" */
.who-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
}
.who-list li {
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.6);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink);
}

/* Checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
  cursor: pointer;
}

/* Banner de instalación */
.install-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.6rem 0.8rem 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: 92vw;
  font-size: 0.88rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.install-banner.hidden { display: none; }
.install-banner button { white-space: nowrap; }

/* ============================================================
   Modo avanzado / romántico — IA emocional, memoria, fotos,
   modo descanso, gratitud, partículas, micrófono, etc.
   ============================================================ */

/* ---------- Micrófono y TTS toggle en chat ----------------- */
.icon-btn.listening {
  background: linear-gradient(135deg, #ffd6e2, #ffb1c8);
  animation: micPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(232, 110, 145, 0.6);
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 110, 145, 0.6); }
  50%      { box-shadow: 0 0 0 10px rgba(232, 110, 145, 0); }
}

/* ---------- Selector de mood (editor de día) --------------- */
.mood-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0 0.4rem;
}
.mood-pick {
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: 600 0.82rem 'Inter', sans-serif;
  color: #3a263a;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.mood-pick:hover { transform: translateY(-1px); }
.mood-pick.active {
  border-color: var(--accent-deep);
  box-shadow: 0 4px 14px rgba(138, 63, 99, 0.25);
}

/* ---------- Diario: toggle año/mes y resumen --------------- */
.diary-toggle {
  display: flex;
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.toggle-btn {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(184, 107, 138, 0.3);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  font: 600 0.78rem 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.diary-summary { margin: 0.4rem 0 0.8rem; }
.sum-headline {
  font: 500 0.95rem 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}
.sum-headline strong { color: var(--accent-deep); }
.sum-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sum-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font: 500 0.75rem 'Inter', sans-serif;
  color: var(--ink-soft);
}
.sum-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ---------- Diario heatmap año (celdas pequeñas) ----------- */
.diary-cell.year {
  height: 10px;
  width: 100%;
  font-size: 0;
  border-radius: 2px;
  padding: 0;
  cursor: pointer;
  border: none;
}
.diary-cell {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* ---------- Galería de fotos ------------------------------- */
.photo-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.photo-card {
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}
.photo-card img {
  width: 100%;
  height: auto;
  display: block;
}
.photo-card figcaption {
  padding: 0.7rem 1rem;
  font: 500 0.88rem 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-soft);
  background: rgba(255, 245, 250, 0.6);
}

/* ---------- Gratitud --------------------------------------- */
.grat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.grat-list li {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.8rem 1rem;
}
.grat-date {
  font: 600 0.72rem 'Inter', sans-serif;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.grat-q {
  font: 500 0.88rem 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0.2rem 0 0.45rem;
}
.grat-a {
  font: 400 0.95rem 'Inter', sans-serif;
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- Bienestar (selector 3x2) ----------------------- */
.wellness-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin: 0.6rem 0;
}
.well-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.1rem 0.5rem;
  border-radius: 18px;
  border: 1px solid var(--card-border);
  background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(245,233,241,0.6));
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.well-btn span {
  font-size: 1.6rem;
  line-height: 1;
}
.well-btn small {
  font: 600 0.78rem 'Inter', sans-serif;
  color: var(--ink);
}
.well-btn:hover { transform: translateY(-2px); }
.well-btn:active { transform: translateY(0); }

/* ---------- Modo dormir (panel oscuro 4-7-8) --------------- */
#sleep .panel-card.sleep-card {
  background: linear-gradient(160deg, #1a1430 0%, #2c1f3d 60%, #3d2745 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
#sleep .panel-card.sleep-card .icon-btn.close { color: rgba(255,255,255,0.85); }
.sleep-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0 1rem;
  min-height: 220px;
}
.sleep-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd9eb 0%, #d68fb8 50%, #6b3a78 100%);
  box-shadow: 0 0 60px rgba(232, 158, 200, 0.35),
              inset 0 0 40px rgba(255, 255, 255, 0.2);
  transform: scale(1);
  transition: transform 4s ease-in-out;
}
.sleep-circle.inhale { transform: scale(1.45); transition: transform 4s ease-in-out; }
.sleep-circle.hold   { transform: scale(1.45); transition: transform 7s linear; }
.sleep-circle.exhale { transform: scale(0.85); transition: transform 8s ease-in-out; }
.sleep-text {
  margin-top: 1rem;
  font: 400 1.15rem 'Cormorant Garamond', serif;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.92);
}
.sleep-ambient {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}
.amb-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 0.7rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.amb-btn span { font-size: 1.4rem; }
.amb-btn small { font: 500 0.7rem 'Inter', sans-serif; }
.amb-btn.on {
  background: rgba(232, 158, 200, 0.25);
  border-color: rgba(232, 158, 200, 0.6);
  box-shadow: 0 0 12px rgba(232, 158, 200, 0.3);
}

/* ---------- Meditaciones ----------------------------------- */
.med-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.med-item {
  text-align: left;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: inherit;
}
.med-item strong {
  font: 600 0.95rem 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  color: var(--ink);
}
.med-item small { color: var(--ink-soft); font-size: 0.78rem; }
.med-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.5rem;
}
.med-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe6f0, #d68fb8 70%);
  box-shadow: 0 0 40px rgba(214, 143, 184, 0.4);
  margin-bottom: 1.2rem;
  animation: medPulse 4s ease-in-out infinite;
}
@keyframes medPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ---------- Estiramientos ---------------------------------- */
.stretch-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}
.stretch-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem 0.9rem;
  align-items: center;
}
.stretch-card h4 {
  margin: 0;
  font: 600 1rem 'Cormorant Garamond', serif;
  grid-column: 2;
}
.stretch-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  grid-column: 2;
  line-height: 1.4;
}
.stretch-card small {
  grid-column: 2;
  font: 600 0.7rem 'Inter', sans-serif;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stretch-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde2ec, #f3c9da);
  grid-row: 1 / span 3;
  position: relative;
  overflow: hidden;
}
.stretch-icon .ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(184, 107, 138, 0.25);
  animation: stretchRipple 2.5s ease-out infinite;
}
@keyframes stretchRipple {
  0%   { transform: scale(0.4); opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ---------- Capa de partículas (corazones) ----------------- */
#hearts-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
}
.heart-p {
  position: absolute;
  top: -30px;
  animation: heartFall 5s linear forwards;
  opacity: 0.95;
  filter: drop-shadow(0 2px 4px rgba(184, 107, 138, 0.3));
}
@keyframes heartFall {
  0%   { transform: translateY(0) rotate(0); opacity: 0.95; }
  85%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(180deg); opacity: 0; }
}

/* ---------- Modo carta papel (panel #letter) --------------- */
#letter .panel-card {
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 240, 230, 0.6), transparent 60%),
    radial-gradient(circle at 80% 90%, rgba(255, 230, 240, 0.5), transparent 60%),
    linear-gradient(180deg, #fef9f3 0%, #faeee0 100%);
  border-color: rgba(201, 163, 106, 0.25);
  box-shadow:
    var(--shadow),
    inset 0 0 60px rgba(201, 163, 106, 0.08);
}
#letter .panel-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(201, 163, 106, 0.18);
  border-radius: calc(var(--radius) - 8px);
  pointer-events: none;
}

/* ---------- Modo noche: refinamientos ---------------------- */
body[data-time="night"] .well-btn {
  background: linear-gradient(135deg, rgba(40, 30, 55, 0.7), rgba(60, 40, 70, 0.5));
  color: #f5e9f1;
}
body[data-time="night"] .well-btn small { color: #f5e9f1; }

/* ---------- Transiciones suaves ---------------------------- */
.panel:not(.hidden) .panel-card {
  animation: panelSlide 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes panelSlide {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- Responsive: bienestar 2 columnas en pantallas chicas - */
@media (max-width: 360px) {
  .wellness-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Inputs y textareas (gratitud, editor de día) ---- */
.panel-body textarea,
.panel-body input[type="text"],
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(184, 107, 138, 0.22);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font: 400 0.98rem 'Cormorant Garamond', serif;
  font-size: 1rem;
  line-height: 1.55;
  outline: none;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(184, 107, 138, 0.05);
  font-family: 'Cormorant Garamond', serif;
}
.panel-body input[type="text"] {
  min-height: 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}
.panel-body textarea::placeholder,
.panel-body input[type="text"]::placeholder {
  color: rgba(107, 90, 104, 0.55);
  font-style: italic;
}
.panel-body textarea:focus,
.panel-body input[type="text"]:focus,
.field input[type="text"]:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(184, 107, 138, 0.18);
}
body[data-time="night"] .panel-body textarea,
body[data-time="night"] .panel-body input[type="text"],
body[data-time="night"] .field textarea {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f5e9f1;
}
body[data-time="night"] .panel-body textarea::placeholder,
body[data-time="night"] .panel-body input[type="text"]::placeholder {
  color: rgba(245, 233, 241, 0.45);
}
body[data-time="night"] .panel-body textarea:focus,
body[data-time="night"] .panel-body input[type="text"]:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 232, 244, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 200, 220, 0.15);
}

/* Footer del panel: que los botones queden bien espaciados */
.panel-card .panel-footer,
#panel-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ============================================================
   Modo noche — overrides consolidados (más legibilidad)
   ============================================================ */
body[data-time="night"] {
  /* Recalibramos acento: rosa-melocotón cálido en lugar de dorado puro
     para que coincida con la estética romántica */
  --accent: #e89ec8;
  --accent-deep: #b86b96;
}

/* Botón primario: que el texto sea siempre legible */
body[data-time="night"] .btn-primary {
  background: linear-gradient(135deg, #e89ec8, #b86b96);
  color: #fff;
  box-shadow: 0 10px 28px rgba(232, 158, 200, 0.28);
}
body[data-time="night"] .btn-primary:hover {
  box-shadow: 0 14px 34px rgba(232, 158, 200, 0.4);
}
body[data-time="night"] .btn-soft {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 232, 244, 0.18);
  color: var(--ink);
}
body[data-time="night"] .btn-soft:hover {
  background: rgba(255, 255, 255, 0.1);
}
body[data-time="night"] .btn-danger {
  color: #ff8a8a;
  border-color: rgba(255, 138, 138, 0.4);
}

/* Iconos / cierre */
body[data-time="night"] .icon-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
body[data-time="night"] .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Hint, quote, headlines */
body[data-time="night"] .hint,
body[data-time="night"] .panel-body .hint {
  color: rgba(245, 233, 241, 0.6);
}
body[data-time="night"] .panel-body .quote {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Mood-picker (pills): mantienen color del mood pero sumamos halo */
body[data-time="night"] .mood-pick {
  color: #1a1530;
  filter: brightness(0.95);
}
body[data-time="night"] .mood-pick.active {
  border-color: #ffd9eb;
  box-shadow: 0 4px 14px rgba(255, 217, 235, 0.25);
}

/* Toggle (30 días / Año) */
body[data-time="night"] .toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 232, 244, 0.18);
  color: rgba(245, 233, 241, 0.75);
}
body[data-time="night"] .toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1530;
}

/* Diario: resumen */
body[data-time="night"] .sum-headline { color: var(--ink); }
body[data-time="night"] .sum-headline strong { color: #ffd9eb; }
body[data-time="night"] .sum-item {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 233, 241, 0.85);
}

/* Galería de fotos */
body[data-time="night"] .photo-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
body[data-time="night"] .photo-card figcaption {
  background: rgba(40, 25, 50, 0.7);
  color: rgba(245, 233, 241, 0.9);
}

/* Lista de gratitud */
body[data-time="night"] .grat-list li {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
body[data-time="night"] .grat-date { color: #ffd9eb; }
body[data-time="night"] .grat-q { color: rgba(245, 233, 241, 0.75); }
body[data-time="night"] .grat-a { color: var(--ink); }

/* Selector de bienestar */
body[data-time="night"] .well-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 232, 244, 0.15);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
body[data-time="night"] .well-btn small { color: var(--ink); }

/* Meditaciones / estiramientos */
body[data-time="night"] .med-item,
body[data-time="night"] .stretch-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
body[data-time="night"] .med-item strong,
body[data-time="night"] .stretch-card h4 { color: var(--ink); }
body[data-time="night"] .med-item small,
body[data-time="night"] .stretch-card p {
  color: rgba(245, 233, 241, 0.65);
}
body[data-time="night"] .stretch-card small { color: #ffd9eb; }
body[data-time="night"] .stretch-icon {
  background: linear-gradient(135deg, rgba(232, 158, 200, 0.25), rgba(184, 107, 150, 0.15));
}
body[data-time="night"] .stretch-icon .ripple {
  background: rgba(232, 158, 200, 0.3);
}

/* Carta papel: mantenerla cálida pero sin chocar con noche */
body[data-time="night"] #letter .panel-card {
  background:
    radial-gradient(circle at 20% 10%, rgba(60, 35, 50, 0.6), transparent 60%),
    radial-gradient(circle at 80% 90%, rgba(80, 40, 60, 0.5), transparent 60%),
    linear-gradient(180deg, #2a1a30 0%, #20142a 100%);
  border-color: rgba(232, 158, 200, 0.25);
}
body[data-time="night"] #letter .panel-card::before {
  border-color: rgba(232, 158, 200, 0.18);
}

/* Modo dormir: ya está oscuro, pero aseguramos contraste de los amb-btn */
body[data-time="night"] #sleep .amb-btn { color: var(--ink); }
body[data-time="night"] #sleep .amb-btn small { color: var(--ink); }

/* Panel summary diario */
body[data-time="night"] .diary-summary { color: var(--ink); }

/* Field hints/labels */
body[data-time="night"] .field > span {
  color: rgba(245, 233, 241, 0.7);
}

/* Action labels e iconos */
body[data-time="night"] .action {
  color: var(--ink);
}
body[data-time="night"] .action-label {
  color: var(--ink);
}

/* Banner de instalación */
body[data-time="night"] .install-banner {
  background: rgba(40, 25, 50, 0.85);
  color: var(--ink);
  border: 1px solid rgba(255, 232, 244, 0.15);
}
