:root {
  --bg-deep: #07030f;
  --card-bg: rgba(22, 12, 42, 0.78);
  --card-border: rgba(192, 132, 252, 0.28);
  --accent-main: #a855f7;
  --accent-glow: #c084fc;
  --accent-soft: rgba(168, 85, 247, 0.16);
  --nebula-color: rgba(168, 85, 247, 0.26);
  --text-main: #f5f0ff;
  --text-body: #ebe3ff;
  --text-muted: #c4b5fd;
  --text-dim: #8b7aa8;
}

/* --- TEMAS DINÁMICOS POR DÍA DE LA SEMANA --- */

/* Martes: Nuestro OST de fondo (Violeta neón épico) */
body.theme-music {
  --accent-main: #a855f7;
  --accent-glow: #d8b4fe;
  --accent-soft: rgba(168, 85, 247, 0.18);
  --card-border: rgba(192, 132, 252, 0.34);
  --nebula-color: rgba(168, 85, 247, 0.3);
}

/* Sábado: Lo que la trae a mi mente (Esmeralda / Menta lunar) */
body.theme-thought {
  --accent-main: #10b981;
  --accent-glow: #6ee7b7;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --card-border: rgba(52, 211, 153, 0.32);
  --nebula-color: rgba(5, 150, 105, 0.25);
}

/* Miércoles: En tu otra pantalla (Azul cian cine) */
body.theme-screen {
  --accent-main: #38bdf8;
  --accent-glow: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.16);
  --card-border: rgba(56, 189, 248, 0.32);
  --nebula-color: rgba(14, 165, 233, 0.26);
}

/* Jueves: Tacos y arepas (Ámbar cálido / Dorado) */
body.theme-warm {
  --accent-main: #f59e0b;
  --accent-glow: #fcd34d;
  --accent-soft: rgba(245, 158, 11, 0.16);
  --card-border: rgba(251, 191, 36, 0.32);
  --nebula-color: rgba(217, 119, 6, 0.24);
}

/* Viernes: Una pregunta para mi tinta (Magenta / Rosa tinta) */
body.theme-ink {
  --accent-main: #ec4899;
  --accent-glow: #f9a8d4;
  --accent-soft: rgba(236, 72, 153, 0.18);
  --card-border: rgba(244, 114, 182, 0.35);
  --nebula-color: rgba(219, 39, 119, 0.28);
}

/* Domingo: Un borrador (Hoja de manuscrito / Pergamino nocturno) */
body.theme-manuscript {
  --accent-main: #d4a373;
  --accent-glow: #faedcd;
  --accent-soft: rgba(212, 163, 115, 0.15);
  --card-bg: rgba(28, 22, 18, 0.88);
  --card-border: rgba(212, 163, 115, 0.36);
  --nebula-color: rgba(180, 130, 80, 0.22);
  --text-main: #fdf8f0;
  --text-body: #f3eadc;
  --text-muted: #e6ccb2;
}

/* Lunes: Algo del estilo para mi (Índigo / Plata) */
body.theme-style {
  --accent-main: #818cf8;
  --accent-glow: #c7d2fe;
  --accent-soft: rgba(129, 140, 248, 0.18);
  --card-border: rgba(165, 180, 252, 0.32);
  --nebula-color: rgba(99, 102, 241, 0.26);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: radial-gradient(circle at top, #170a2e 0%, var(--bg-deep) 72%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
  padding: 1.5rem 1rem 4rem;
  transition: background 0.6s ease;
}

.stars-bg {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #f3e8ff, transparent),
    radial-gradient(1px 1px at 90px 140px, #c084fc, transparent),
    radial-gradient(2px 2px at 160px 80px, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 250px 210px, #f472b6, transparent),
    radial-gradient(1px 1px at 45px 260px, #bae6fd, transparent);
  background-size: 310px 310px;
  opacity: 0.5;
  z-index: -3;
  animation: twinkle 7s ease-in-out infinite alternate;
}

.stars-layer-2 {
  background-size: 470px 470px;
  background-position: 120px 60px;
  opacity: 0.35;
  animation: twinkle 11s ease-in-out infinite alternate-reverse;
}

.nebula-glow {
  position: fixed;
  top: -12%;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 440px;
  background: radial-gradient(circle, var(--nebula-color) 0%, transparent 70%);
  filter: blur(65px);
  z-index: -2;
  pointer-events: none;
  transition: background 0.6s ease;
}

.shooting-stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.shooting-stars span {
  position: absolute;
  top: 10%;
  left: 80%;
  width: 110px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.85), transparent);
  transform: rotate(-35deg);
  opacity: 0;
  animation: shoot 9s linear infinite;
}

.shooting-stars span:nth-child(2) {
  top: 28%;
  left: 92%;
  animation-delay: 3.5s;
  animation-duration: 11s;
}

.shooting-stars span:nth-child(3) {
  top: 6%;
  left: 55%;
  animation-delay: 6.5s;
  animation-duration: 10s;
}

@keyframes shoot {
  0% { transform: translate(0, 0) rotate(-35deg); opacity: 0; }
  4% { opacity: 0.9; }
  14% { transform: translate(-520px, 360px) rotate(-35deg); opacity: 0; }
  100% { opacity: 0; }
}

@keyframes twinkle {
  from { opacity: 0.32; }
  to { opacity: 0.72; }
}

.app-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.top-header {
  text-align: center;
  padding-top: 0.4rem;
}

.badge-pill {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-soft);
  border: 1px solid var(--card-border);
  color: var(--accent-glow);
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

.main-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  margin-top: 0.65rem;
  background: linear-gradient(135deg, #ffffff 20%, var(--accent-glow) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

.progress-wrapper {
  max-width: 440px;
  margin: 1.2rem auto 0;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 2%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-main), var(--accent-glow));
  box-shadow: 0 0 12px var(--accent-main);
  transition: width 0.5s ease, background 0.5s ease;
}

.header-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent-glow);
  transform: translateY(-1px);
}

/* --- TARJETA / CARTA NOCTURNA --- */
.glass-panel {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 2rem 1.8rem;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.card-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent-glow);
  opacity: 0.45;
  pointer-events: none;
  transition: border-color 0.5s ease;
}
.card-corner.tl { top: 12px; left: 12px; border-top: 1.5px solid; border-left: 1.5px solid; border-top-left-radius: 6px; }
.card-corner.tr { top: 12px; right: 12px; border-top: 1.5px solid; border-right: 1.5px solid; border-top-right-radius: 6px; }
.card-corner.bl { bottom: 12px; left: 12px; border-bottom: 1.5px solid; border-left: 1.5px solid; border-bottom-left-radius: 6px; }
.card-corner.br { bottom: 12px; right: 12px; border-bottom: 1.5px solid; border-right: 1.5px solid; border-bottom-right-radius: 6px; }

.card-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.day-number {
  background: linear-gradient(135deg, var(--accent-main), var(--accent-glow));
  color: #0b0514;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
}

.theme-tag {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-glow);
  background: var(--accent-soft);
  border: 1px solid var(--card-border);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
}

.card-date {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.25rem;
  line-height: 1.25;
}

.card-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 1.35rem;
  color: var(--accent-glow);
  font-size: 0.75rem;
  opacity: 0.7;
}

.card-divider::before,
.card-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
}

.media-container {
  margin-bottom: 1.4rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.media-container iframe,
.media-container img {
  width: 100%;
  display: block;
  border: none;
}

.card-body {
  font-size: 1.02rem;
  color: var(--text-body);
  white-space: pre-line;
  line-height: 1.8;
}

/* Estilo especial de Hoja Editorial para los Domingos (Un borrador) */
body.theme-manuscript .day-card {
  background-image:
    linear-gradient(90deg, rgba(212, 163, 115, 0.14) 1px, transparent 1px),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 31px,
      rgba(212, 163, 115, 0.06) 32px
    );
  background-size: 100% 100%, 100% 32px;
  background-position: 28px 0, 0 0;
}

body.theme-manuscript .card-body {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.06rem;
  line-height: 1.9;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(212, 163, 115, 0.35);
}

.card-signature {
  margin-top: 1.6rem;
  text-align: right;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent-glow);
  opacity: 0.9;
}

/* --- CAJA DE PREGUNTA / RETO (VIERNES) --- */
.prompt-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent-glow);
}

.prompt-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-glow);
  margin-bottom: 0.4rem;
}

.prompt-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.12rem;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.btn-primary {
  width: 100%;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent-main), var(--accent-glow));
  color: #0b0514;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px var(--accent-soft);
}

/* --- NAVEGACIÓN INFERIOR --- */
.card-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.5rem;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0.55rem 1rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent-glow);
}

.nav-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.nav-indicator {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- CALENDARIO 365 POR MESES --- */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
}

.calendar-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.days-grid {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.month-block {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1rem;
}

.month-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  color: var(--accent-glow);
  text-transform: capitalize;
  margin-bottom: 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}

.day-star {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: not-allowed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  transition: transform 0.18s ease, border-color 0.2s ease;
}

.day-star .cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dot-color, var(--accent-glow));
  opacity: 0.4;
}

.day-star.unlocked {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--dot-color, var(--card-border));
  color: var(--text-main);
  cursor: pointer;
}

.day-star.unlocked .cal-dot {
  opacity: 1;
  box-shadow: 0 0 6px var(--dot-color, var(--accent-glow));
}

.day-star.unlocked:hover {
  transform: scale(1.08);
  background: var(--accent-soft);
}

.day-star.active {
  background: var(--accent-main);
  color: #0b0514;
  border-color: #ffffff;
}

.day-star.active .cal-dot {
  background: #0b0514;
}

.day-star.special-date {
  box-shadow: inset 0 0 10px rgba(251, 191, 36, 0.35);
}

/* --- TOAST --- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent-main);
  color: #0b0514;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 520px) {
  .glass-panel {
    padding: 1.5rem 1.2rem;
  }
}