/* =========================================================
   AMANECER — Devocional Diario
   Identidad visual: horizonte cálido, luz creciente sobre crema
   ========================================================= */

:root{
  --bg-deep:      #F7F0E3;
  --bg-deep-2:    #FBF6EA;
  --card:         #FFF9EF;
  --card-line:    rgba(16,45,31,0.12);
  --dawn:         #C38A2D;
  --dawn-soft:    #D8AD62;
  --dawn-dim:     #72512E;
  --text:         #102D1F;
  --text-muted:   #5C6B54;
  --text-faint:   #8C8570;
  --btn-text:     #102D1F;
  --text-on-photo: #FFF9EF;
  --overlay-dark: 16,45,31;

  --radius-card: 18px;
  --radius-btn: 12px;
  --max-w: 460px;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0;
  height:100%;
  overflow:hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--bg-deep-2) 0%, var(--bg-deep) 65%, #EFDFC0 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Karla', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* El scroll ahora ocurre DENTRO de estos contenedores (no en body).
   Esto evita el bug de iOS/Safari donde la barra inferior "position:fixed"
   se queda pegada al contenido y se mueve de forma rara durante el scroll. */
#onboarding-root, #app{
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

h1,h2,h3,h4, .serif{
  font-family: 'Fraunces', serif;
  font-weight: 600;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.italic-quote{
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
}

p{ margin: 0 0 12px 0; line-height: 1.55; color: var(--text); }

a{ color: var(--dawn-dim); }

button{ font-family: inherit; cursor:pointer; }

#app{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 18px calc(100px + env(safe-area-inset-bottom));
}

/* ---------- Card: instalar en pantalla de inicio ---------- */
.install-card{
  position: relative;
  background: linear-gradient(180deg, var(--card), rgba(232,216,191,0.7));
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 24px -14px rgba(16,45,31,0.25);
}
.install-card-head{
  display:flex; align-items:flex-start; gap:10px;
  margin-bottom: 12px;
}
.install-card-icon{
  width:38px; height:38px; border-radius:50%;
  background: rgba(195,138,45,0.15);
  display:flex; align-items:center; justify-content:center;
  font-size:1.1rem; flex-shrink:0;
}
.install-card-headtext{ flex:1; }
.install-card-headtext h3{
  font-family:'Karla',sans-serif; font-weight:700; font-size:0.95rem;
  margin:0 0 2px 0; color: var(--text);
}
.install-card-headtext p{
  margin:0; font-size:0.8rem; color: var(--text-muted);
}
.install-card .close-x{
  position: static; flex-shrink:0;
  color: var(--text-faint); font-size:1.1rem;
}
.install-card-tabs{
  display:flex; gap:8px; margin-bottom: 12px;
}
.install-tab{
  flex:1;
  border: 1px solid var(--card-line);
  background: rgba(16,45,31,0.04);
  color: var(--text-muted);
  border-radius: var(--radius-btn);
  padding: 9px;
  font-weight: 700;
  font-size: 0.85rem;
}
.install-tab.active{
  background: linear-gradient(180deg, var(--dawn-soft), var(--dawn));
  color: var(--btn-text);
  border-color: transparent;
}
.install-steps{
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: install-step;
}
.install-steps li{
  position: relative;
  counter-increment: install-step;
  padding: 6px 0 6px 32px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text);
}
.install-steps li::before{
  content: counter(install-step);
  position: absolute;
  left: 0; top: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(195,138,45,0.18);
  color: var(--dawn-dim);
  font-weight: 700; font-size: 0.75rem;
  display:flex; align-items:center; justify-content:center;
}
.install-steps strong{ color: var(--dawn-dim); }

/* ---------- Banner decorativo (Home) ---------- */
.top-banner{
  width: 100%;
  aspect-ratio: 3 / 1;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-line);
  background-size: cover;
  background-position: center;
  margin-bottom: 18px;
}

/* ---------- Header / greeting ---------- */
.top-header{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom: 18px;
}
.brand{
  display:flex; align-items:center; gap:8px;
  font-family:'Fraunces',serif; font-weight:600; font-size:1.05rem;
  color: var(--dawn-dim);
}
.brand .sun-dot{
  width:10px; height:10px; border-radius:50%;
  background: var(--dawn);
  box-shadow: 0 0 10px 2px rgba(195,138,45,0.5);
}
.icon-btn{
  width:40px; height:40px; border-radius:50%;
  border:1px solid var(--card-line);
  background: rgba(255,249,239,0.8);
  color: var(--text);
  display:flex; align-items:center; justify-content:center;
  font-size:1.1rem;
}

.greeting{
  margin-bottom: 18px;
}
.greeting h1{
  font-size:1.6rem;
}
.greeting .date-line{
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ---------- Cards ---------- */
.card{
  background: linear-gradient(180deg, var(--card), rgba(232,216,191,0.7));
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 24px -14px rgba(16,45,31,0.25);
}
.card.featured{
  background: linear-gradient(160deg, #FBF3E2 0%, var(--card) 60%, #F3E5C8 100%);
  border-color: rgba(195,138,45,0.35);
  position: relative;
  overflow: hidden;
}
.card.featured::before{
  content:"";
  position:absolute; top:-40%; right:-30%;
  width:220px; height:220px; border-radius:50%;
  background: radial-gradient(circle, rgba(195,138,45,0.30) 0%, rgba(195,138,45,0) 70%);
  pointer-events:none;
}
.card-eyebrow{
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--dawn-dim);
  font-weight: 700;
  margin-bottom: 6px;
}
.card-ref{
  font-family:'Fraunces',serif; font-style: italic;
  color: var(--dawn-dim);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

/* ---------- Buttons ---------- */
.btn{
  border:none;
  border-radius: var(--radius-btn);
  padding: 13px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  width:100%;
}
.btn-primary{
  background: linear-gradient(180deg, var(--dawn-soft), var(--dawn));
  color: var(--btn-text);
  box-shadow: 0 8px 20px -8px rgba(195,138,45,0.5);
}
.btn-secondary{
  background: rgba(16,45,31,0.05);
  color: var(--text);
  border: 1px solid var(--card-line);
}
.btn-ghost{
  background: transparent;
  color: var(--dawn-dim);
  border: 1px solid var(--dawn-dim);
}
.btn-sm{ width:auto; padding: 9px 14px; font-size:0.85rem; }
.btn:disabled{ opacity:0.55; cursor:not-allowed; }

/* ---------- Mood chips ---------- */
.chip-row{
  display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 6px;
}
.chip{
  border:1px solid var(--card-line);
  background: rgba(16,45,31,0.04);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  display:flex; align-items:center; gap:6px;
}
.chip.selected{
  background: linear-gradient(180deg, var(--dawn-soft), var(--dawn));
  color: var(--btn-text);
  border-color: transparent;
}

/* ---------- Barra Horizonte (signature progress bar) ---------- */
.horizon-bar{
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(114,81,46,0.18);
  overflow: visible;
  margin: 14px 0 20px 0;
}
.horizon-bar .fill{
  position:absolute; left:0; top:0; bottom:0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--dawn-dim), var(--dawn) 70%, var(--dawn-soft));
  transition: width 0.6s ease;
}
.horizon-bar .sun{
  position:absolute; top:50%;
  width:14px; height:14px; border-radius:50%;
  background: var(--dawn-soft);
  box-shadow: 0 0 12px 4px rgba(195,138,45,0.6), 0 0 2px 1px #fff8;
  transform: translate(-50%,-50%);
  transition: left 0.6s ease;
}
.horizon-label{
  display:flex; justify-content:space-between;
  font-size:0.78rem; color: var(--text-muted);
  margin-top: 4px;
}
.horizon-label strong{ color: var(--dawn-dim); }

/* ---------- Tabs / Bottom nav ---------- */
.bottom-nav{
  position: fixed; left:0; right:0; bottom:0;
  display:flex; justify-content:center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 40;
}
.bottom-nav-inner{
  width:100%; max-width: var(--max-w);
  display:flex;
  background: rgba(255,249,239,0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--card-line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn{
  flex:1; background:none; border:none; color: var(--text-faint);
  display:flex; flex-direction:column; align-items:center; gap:3px;
  font-size:0.68rem; font-weight:700; padding:6px 2px;
  border-radius:10px;
}
.nav-btn .nav-icon{ font-size:1.15rem; }
.nav-btn.active{ color: var(--dawn-dim); }

/* ---------- Puertas grid ---------- */
.puertas-grid{
  display:grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.puerta-card{
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-line);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
}
.puerta-card::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(var(--overlay-dark),0) 42%, rgba(var(--overlay-dark),0.90) 100%);
}
.puerta-card .puerta-label{
  position: relative;
  z-index: 2;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-on-photo);
  line-height: 1.2;
}
.puerta-card .puerta-emoji{ font-size: 1rem; }

/* ---------- Search bar ---------- */
.search-bar{
  display:flex; align-items:center; gap:8px;
  background: rgba(16,45,31,0.05);
  border:1px solid var(--card-line);
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.search-bar input{
  flex:1; background:transparent; border:none; outline:none;
  color: var(--text); font-family:'Karla',sans-serif; font-size:0.9rem;
}
.search-bar input::placeholder{ color: var(--text-faint); }

/* ---------- Devotional detail ---------- */
.devo-ref{
  font-family:'Fraunces',serif; font-style:italic; color: var(--dawn-dim);
  font-size:1.3rem; margin-bottom: 10px;
}
.devo-body{ color: var(--text); white-space: pre-line; }
.devo-prayer{
  border-left: 3px solid var(--dawn);
  padding-left: 12px;
  font-style: italic;
  font-family:'Fraunces',serif;
  color: var(--text-muted);
  margin-top: 14px;
}
.audio-player{
  display:flex; align-items:center; gap:10px;
  background: rgba(195,138,45,0.1);
  border:1px solid rgba(195,138,45,0.3);
  border-radius: var(--radius-btn);
  padding: 12px 14px;
  margin: 14px 0;
}
.audio-player .play-btn{
  width:38px; height:38px; border-radius:50%;
  background: var(--dawn); color:var(--btn-text);
  border:none; display:flex; align-items:center; justify-content:center;
  font-size:1rem; flex-shrink:0;
}
.audio-player .meta{ flex:1; font-size:0.8rem; color: var(--text-muted); }

/* ---------- Música (player) ---------- */
.musica-track{ margin-bottom:10px; padding:10px 14px; }
.musica-track-titulo{ font-family:'Fraunces',serif; font-size:0.95rem; }
.musica-track-btn{
  width:38px; height:38px; border-radius:50%; padding:0;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.musica-player-bar{
  position: sticky; bottom: 76px;
  display:flex; align-items:center; gap:12px;
  background: var(--card);
  border:1px solid rgba(195,138,45,0.3);
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  margin-top: 14px;
  box-shadow: 0 6px 18px rgba(16,45,31,0.12);
}
.musica-player-info{ flex:1; min-width:0; }
.musica-player-titulo{
  font-family:'Fraunces',serif; font-size:0.9rem;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.musica-player-sub{ font-size:0.72rem; color: var(--text-muted); }
#musica-player-toggle{ width:38px; height:38px; border-radius:50%; padding:0; flex-shrink:0; }

/* ---------- Crisis button ---------- */
.crisis-fab{
  position: fixed;
  right: 16px;
  bottom: 92px;
  width: 64px; height:64px; border-radius:50%;
  background: radial-gradient(circle at 35% 30%, #E27A5C, #B23B2C 65%, #7A2A1E 100%);
  color: #FFF9EF;
  border: 2px solid rgba(255,249,239,0.55);
  box-shadow: 0 10px 26px -6px rgba(178,59,44,0.65);
  display:flex; align-items:center; justify-content:center;
  font-size:1.6rem;
  z-index: 50;
  animation: crisisPulse 2.6s ease-in-out infinite;
}
@keyframes crisisPulse{
  0%, 100%{ box-shadow: 0 10px 26px -6px rgba(178,59,44,0.65), 0 0 0 0 rgba(178,59,44,0.45); }
  50%{ box-shadow: 0 10px 26px -6px rgba(178,59,44,0.65), 0 0 0 12px rgba(178,59,44,0); }
}

/* ---------- Modal / overlay ---------- */
.overlay{
  position: fixed; inset:0; background: rgba(16,45,31,0.45);
  display:flex; align-items:flex-end; justify-content:center;
  z-index: 60;
}
.overlay.center{ align-items:center; padding: 20px; }
.sheet{
  width:100%; max-width: var(--max-w);
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 85vh; overflow-y:auto;
}
.overlay.center .sheet{ border-radius: var(--radius-card); max-height: 90vh; }

.close-x{
  position:absolute; top:14px; right:16px;
  background:none; border:none; color: var(--text-muted); font-size:1.3rem;
}

/* ---------- Forms ---------- */
label{ display:block; font-size:0.82rem; color: var(--text-muted); margin-bottom:6px; font-weight:700; }
input[type=text], input[type=password], input[type=time], select, textarea{
  width:100%;
  background: rgba(16,45,31,0.05);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-btn);
  padding: 11px 13px;
  color: var(--text);
  font-family:'Karla',sans-serif;
  font-size: 0.92rem;
  margin-bottom: 14px;
}
textarea{ min-height: 120px; resize: vertical; }
.field-group{ margin-bottom: 8px; }

/* ---------- Misc ---------- */
.section-title{
  font-size: 1.15rem;
  margin: 22px 0 12px 0;
}
.muted{ color: var(--text-muted); font-size:0.85rem; }
.faint{ color: var(--text-faint); font-size:0.78rem; }
.center-text{ text-align:center; }
.stack{ display:flex; flex-direction:column; gap:10px; }
.row{ display:flex; gap:10px; }
.row > *{ flex:1; }
.badge{
  display:inline-flex; align-items:center; gap:4px;
  background: rgba(195,138,45,0.15);
  color: var(--dawn-dim);
  border-radius:999px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-read{
  background: transparent;
  border: 1px solid var(--text-faint);
  color: var(--text-muted);
  font-weight: 600;
  margin-left: 6px;
}
.list-item{
  display:flex; justify-content:space-between; align-items:center;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-line);
}
.list-item:last-child{ border-bottom:none; }
.pill-btn{
  border-radius:999px; border:1px solid var(--card-line);
  background: rgba(16,45,31,0.04); color: var(--text);
  padding: 8px 14px; font-size:0.82rem; font-weight:700;
}
.gift-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.gift-card{
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-line);
  background-color: var(--dawn-dim);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
}
.gift-card::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(var(--overlay-dark),0) 40%, rgba(var(--overlay-dark),0.92) 100%);
}
.gift-card .gift-label{
  position: relative;
  z-index: 2;
  padding: 12px 10px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-on-photo);
  line-height: 1.25;
}
.gift-card .gift-lock{
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  z-index: 3;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(var(--overlay-dark),0.75);
  border: 1px solid rgba(195,138,45,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 18px 4px rgba(195,138,45,0.25);
}
.gift-card.unlocked .gift-lock{ display: none; }
.gift-card.unlocked::after{
  background: linear-gradient(180deg, rgba(var(--overlay-dark),0) 55%, rgba(var(--overlay-dark),0.85) 100%);
}

/* ---------- Feature card (banner ancho, mismo lenguaje visual de Las 6 Puertas) ---------- */
.feature-card{
  position: relative;
  aspect-ratio: 16 / 8;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-line);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  margin-bottom: 16px;
}
.feature-card::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(var(--overlay-dark),0) 34%, rgba(var(--overlay-dark),0.92) 100%);
}
.feature-card .feature-label{
  position: relative;
  z-index: 2;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-on-photo);
}
.feature-card .feature-lock{
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  z-index: 3;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(var(--overlay-dark),0.75);
  border: 1px solid rgba(195,138,45,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 0 18px 4px rgba(195,138,45,0.25);
}

.screen{ display:none; }
.screen.active{ display:block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn{ from{ opacity:0; transform: translateY(6px);} to{opacity:1; transform:translateY(0);} }

.plan-list{
  list-style: none;
  margin: 0 0 14px 0;
  padding: 0;
}
.plan-list li{
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 5px 0;
}

.locked-wrap{
  min-height: 60vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; text-align:center; gap:14px;
}
.locked-wrap .lock-icon{ font-size:2.4rem; }

.toast{
  position: fixed; left:50%; bottom: 100px; transform: translateX(-50%);
  background: var(--dawn); color: var(--btn-text);
  padding: 10px 18px; border-radius: 999px; font-weight:700; font-size:0.85rem;
  box-shadow: 0 8px 20px -6px rgba(16,45,31,0.4);
  z-index: 80; opacity:0; pointer-events:none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show{ opacity:1; transform: translateX(-50%) translateY(-6px); }

.spotify-embed-placeholder{
  border: 1px dashed var(--dawn-dim);
  border-radius: var(--radius-btn);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  background: rgba(16,45,31,0.03);
}

.onboarding-screen{
  min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; text-align:center;
  padding: 32px 24px;
  max-width: var(--max-w); margin:0 auto;
}
.onboarding-sun{
  width:64px; height:64px; border-radius:50%;
  background: radial-gradient(circle at 35% 30%, var(--dawn-soft), var(--dawn));
  box-shadow: 0 0 40px 10px rgba(195,138,45,0.35);
  margin-bottom: 20px;
}

@media (min-width: 480px){
  #app{ padding-top: 28px; }
}

/* ---------- Paywall / contenido trancado ---------- */
[data-locked-feature]{
  position: relative;
  cursor: pointer;
}
.lock-ribbon{
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(var(--overlay-dark),0.85);
  border: 1px solid rgba(195,138,45,0.45);
  color: var(--dawn-soft);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
  white-space: nowrap;
}
.locked-blur{
  filter: blur(3px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.locked-inline{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(195,138,45,0.14);
  color: var(--dawn-dim);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 6px;
}
.chip.chip-locked{
  opacity: 0.5;
}
.chip.chip-locked .chip-lock{
  margin-left: 2px;
}
.search-bar.locked{ position: relative; }
.search-bar.locked input{ pointer-events: none; }
.audio-player.locked .play-btn{
  background: var(--dawn-dim);
  color: var(--text-faint);
  pointer-events: none;
}
.paywall-sun{
  width:48px; height:48px; border-radius:50%;
  background: radial-gradient(circle at 35% 30%, var(--dawn-soft), var(--dawn));
  box-shadow: 0 0 26px 6px rgba(195,138,45,0.35);
  margin-bottom: 14px;
}
