/* «Elige tu Destino» — estilos. Pensado para móvil (390 px como en Adalo)
   y centrado como un teléfono en pantallas grandes. */

:root {
  --primario: #75a3fa;
  --primario-oscuro: #4f7fd6;
  --secundario: #FFC00E;
  --amarillo: #efe563;
  --texto: #424242;
  --fondo: #ffffff;
  --verde: #357925;
  --verde-oscuro: #1a580b;
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ancho: 430px;
  --barra: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: #1d1d1f; color: var(--texto); font-family: var(--sans); }
body.menu-abierto { overflow: hidden; }
a { color: inherit; }
img { max-width: 100%; display: block; }

#app {
  position: relative; max-width: var(--ancho); min-height: 100vh; margin: 0 auto;
  background: var(--fondo); overflow-x: hidden; box-shadow: 0 0 40px rgba(0,0,0,.4);
}

/* ---------- barra superior y menú lateral */
.barra {
  position: sticky; top: 0; z-index: 20; height: var(--barra);
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
  background: rgba(255,255,255,.96); border-bottom: 1px solid #e0e0e0;
}
.barra-boton, .barra-hueco { width: 44px; height: 44px; border: 0; background: none; font-size: 26px; color: #000; cursor: pointer; }
.barra-logo img { height: 22px; width: auto; }

.cortina { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 30; }
.lateral {
  position: fixed; top: 0; bottom: 0; left: max(0px, calc(50% - var(--ancho) / 2)); width: 280px; z-index: 31;
  background: #fff; padding: 20px 12px; transform: translateX(-110%); transition: transform .25s;
  display: flex; flex-direction: column; gap: 4px; box-shadow: 2px 0 12px rgba(0,0,0,.2);
}
.menu-abierto .cortina { opacity: 1; pointer-events: auto; }
.menu-abierto .lateral { transform: none; }
.lateral-logo { height: 26px; width: auto; margin: 4px 8px 16px; }
.lateral-perfil { display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 10px; background: #F5F5F5; border-radius: 24px; font-weight: 600; }
.lateral a { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 8px; text-decoration: none; font-weight: 500; }
.lateral a.activo { background: var(--primario); color: #fff; }
.lateral a:hover:not(.activo) { background: #e0e0e0cc; }
.icono { width: 24px; text-align: center; font-size: 18px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center; background: var(--primario); color: #fff; font-weight: 700; flex-shrink: 0; text-decoration: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.grande { width: 150px; height: 150px; font-size: 56px; margin: 10px auto; }

/* ---------- pantallas */
.pantalla {
  min-height: calc(100vh - var(--barra)); background-size: cover; background-position: center top;
  background-repeat: no-repeat; padding: 24px 23px 40px;
}
.pantalla:first-child { min-height: 100vh; }

/* botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; min-width: 160px; min-height: 40px;
  padding: 8px 20px; border-radius: 18px; border: 2px solid transparent; cursor: pointer;
  font: 600 15px/1.2 var(--sans); letter-spacing: .04em; text-decoration: none; text-align: center;
  transition: transform .1s, filter .15s;
}
.boton:active { transform: scale(.97); }
.boton:hover { filter: brightness(1.05); }
.boton.ancho { width: 100%; }
.boton.amarillo { background: var(--amarillo); color: #222; }
.boton.blanco { background: #fff; color: #222; }
.boton.contorno.blanco { background: transparent; border-color: #fff; color: #fff; }
.boton.verde { background: var(--verde); color: #fff; border-radius: 12px; }
.boton.contorno.verde { background: transparent; border-color: var(--verde-oscuro); color: var(--verde-oscuro); }
.boton.azul { background: var(--primario); color: #fff; }
.boton.azul-oscuro { background: var(--primario-oscuro); color: #fff; border-radius: 8px; }
.boton.plano { background: none; color: var(--texto); }
.boton.gris { color: #9e9e9e; }
.boton.peligro { background: #d64545; color: #fff; }
.peligro-texto { color: #d64545 !important; }
.enlace { background: none; border: 0; color: var(--primario-oscuro); font: 600 15px var(--sans); cursor: pointer; text-decoration: none; }

/* botón con la imagen de fondo de Adalo y texto blanco encima */
.boton-img {
  display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 8px 10px;
  background-size: 100% 100%; background-color: #2b2b2b; color: #fff; text-decoration: none; text-align: center;
  font: 500 16px/1.25 var(--sans);
}
.boton-img:active { filter: brightness(1.2); }

/* ---------- bienvenida y acceso */
.bienvenida { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; }
.bienvenida-logo { width: 300px; }
.bienvenida-botones { display: flex; flex-direction: column; gap: 14px; }

.acceso { display: flex; align-items: center; justify-content: center; }
.tarjeta-acceso {
  position: relative; width: 100%; background: rgba(255,255,255,.96); border-radius: 12px;
  padding: 28px 24px; box-shadow: 0 8px 30px rgba(0,0,0,.25); text-align: center;
}
.tarjeta-acceso h1 { font: 700 28px var(--serif); margin: 0 0 20px; }
.tarjeta-acceso form, .diario-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input, textarea {
  font: 16px var(--sans); padding: 12px; border: 1px solid #cfcfcf; border-radius: 6px; background: #fff; color: var(--texto);
}
input:focus, textarea:focus { outline: 2px solid var(--primario); border-color: transparent; }
.tarjeta-acceso .enlace { display: inline-block; margin-top: 18px; }
.error { color: #c62828; font-size: 14px; margin: 0; }
.error.ok { color: #2e7d32; background: #e8f5e9; padding: 10px 12px; border-radius: 6px; line-height: 1.4; }
.intro-acceso { margin: -8px 0 16px; color: #555; line-height: 1.5; }
.arranque { min-height: 100vh; display: grid; place-items: center; }
.arranque img { width: 220px; animation: latir 1.4s ease-in-out infinite; }
@keyframes latir { 50% { opacity: .45; } }
.ajustes-plan { text-align: center; margin: 0 0 6px; font-size: 14px; }
button[disabled] { opacity: .6; cursor: progress; }
.cerrar { position: absolute; top: 8px; right: 14px; font-size: 30px; text-decoration: none; }
.selector-imagen { margin: 16px 0; height: 260px; border: 2px dashed #ccc; border-radius: 8px; display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.selector-imagen img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- menú y frase */
.menu { padding: 0; display: flex; flex-direction: column; }
.menu-tile img { width: 100%; height: 140px; object-fit: cover; }
.menu-tile, .banda { margin-top: 8px; }
.banda { min-height: 48px; justify-content: flex-start; padding-left: 23px; font-weight: 700; letter-spacing: .05em; }
.frase { padding: 0; display: flex; }
.frase-img { width: 100%; height: calc(100vh - var(--barra)); object-fit: cover; }

/* ---------- portadas (catálogo, libros, diario) */
.portada {
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding-top: 90px; padding-bottom: 70px; text-align: center; color: #fff;
}
.titulo-portada { font: 800 30px/1.15 var(--sans); color: #fff; margin: 0 0 30px; text-shadow: 0 2px 12px rgba(0,0,0,.45); }
.titulo-portada.grande { font-size: 50px; }
.portada-abajo { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.portada .titulo-portada:not(.grande) { font-size: 44px; }
.finales { margin: 6px 0 0; font-size: 14px; text-shadow: 0 1px 6px rgba(0,0,0,.7); }

.catalogo-titulo { font: 800 24px var(--sans); text-align: center; margin: 4px 0 20px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.catalogo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; }
.libro-tarjeta { position: relative; text-decoration: none; display: flex; flex-direction: column; }
.libro-tarjeta img { width: 100%; aspect-ratio: 163 / 183; object-fit: cover; }
.libro-nombre { min-height: 47px; display: grid; place-items: center; padding: 4px 6px; background-size: 100% 100%; background-color: #2b2b2b; color: #fff; font-size: 14px; font-weight: 500; text-align: center; }
.sello { position: absolute; top: 8px; right: -4px; background: var(--secundario); color: #222; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 3px; }

/* ---------- lectura */
.lectura { text-align: center; }
.libro-cabecera { margin: -8px 0 18px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }
.texto { font: 500 16px/1.6 var(--sans); }
.texto p { margin: 0 0 1em; }
.ilustracion { width: 100%; margin: 12px 0; }
.opciones { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 28px; }
.opciones.n2, .opciones.n4 { grid-template-columns: 1fr 1fr; gap: 0; }
.opciones.n3 { grid-template-columns: 1fr 1fr; gap: 14px 0; }
.opciones.n3 .opcion:nth-child(3) { grid-column: 1 / -1; } /* como en Adalo: 2 arriba, 1 ancha debajo */
.partida { position: relative; margin-top: 28px; }
.partida img { width: 100%; height: 198px; object-fit: cover; }
.partida + .opciones { margin-top: 0; }
.mitad { position: absolute; top: 0; bottom: 0; width: 50%; display: flex; align-items: flex-end; padding: 10px; text-decoration: none; color: #fff; transition: background .2s; }
.mitad.izq { left: 0; justify-content: flex-start; } .mitad.der { right: 0; justify-content: flex-end; }
.mitad span { background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity .2s; }
.mitad:hover, .mitad:focus-visible { background: rgba(255,255,255,.14); } .mitad:hover span, .mitad:focus-visible span { opacity: 1; }
@media (hover: none) { .mitad span { opacity: .85; } }
.opcion { display: flex; flex-direction: column; }
.opcion-img { width: 100%; height: 198px; object-fit: cover; }
.opciones.n1 .opcion-img { height: auto; max-height: 260px; }
.opcion .boton-img { flex: 1; }
.pagina-imagen { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 80px; }
.pagina-imagen .abajo { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.aviso { text-align: center; padding-top: 30vh; }
.autor { background: #fff8d6; border: 1px solid #e8d77a; color: #5b4c00; font-size: 13px; padding: 8px 10px; border-radius: 6px; margin-bottom: 16px; text-align: left; }

/* ---------- diario */
.diario-cabecera { text-align: center; margin-bottom: 20px; }
.diario-cabecera h1 { font: 700 24px var(--serif); margin: 0 0 16px; }
.diario-cabecera small { font: 500 16px var(--sans); }
.vacio { text-align: center; opacity: .7; }
.diario-lista { display: flex; flex-direction: column; gap: 18px; }
.diario-tarjeta { background: rgba(255,255,255,.92); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.12); padding-bottom: 14px; position: relative; }
.diario-tarjeta img { width: 100%; height: 180px; object-fit: cover; }
.diario-tarjeta h3, .diario-tarjeta p { margin: 12px 14px 0; }
.diario-tarjeta .boton { margin: 14px 14px 0; }
.chip { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 12px; }
.diario-form h1 { font: 700 24px var(--serif); text-align: center; margin: 0 0 6px; }
.diario-detalle { background: rgba(255,255,255,.92); border-radius: 10px; padding: 20px; }
.diario-detalle h2 { font: 700 20px var(--serif); margin: 22px 0 8px; }
.diario-detalle h2:first-child { margin-top: 0; }
.diario-detalle .fecha { margin-top: 0; opacity: .6; font-size: 14px; }
.diario-detalle .hero { width: 100%; border-radius: 8px; margin: 14px 0; }
.hashtag { font-weight: 700; color: var(--primario-oscuro); }

/* ---------- ajustes */
.ajustes { display: flex; flex-direction: column; gap: 10px; background-color: rgba(255,255,255,.9); background-blend-mode: lighten; }
.ajustes-titulo { font: 700 24px var(--serif); text-align: center; margin: 0; }
.ajustes-nombre { text-align: center; font-weight: 700; font-size: 18px; margin: 0; }
.ajustes-email { text-align: center; margin: 0 0 6px; opacity: .7; }
.ajustes h2 { font-size: 18px; margin: 10px 0 0; }
.campo-ajuste { display: flex; align-items: flex-end; gap: 10px; background: #fff; padding: 12px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.campo-ajuste label { flex: 1; }
.campo-ajuste .enlace { padding-bottom: 12px; }
.interruptor { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; margin: 10px 0; }
.ajustes .boton { align-self: center; }
.ajustes-pie { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 20px; }
.ajustes-pie img { max-width: 220px; }

/* ---------- ventana de confirmación */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-caja { background: #fff; border-radius: 12px; padding: 22px; max-width: 340px; }
.modal-botones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.modal-botones .boton { min-width: 0; }

@media (min-width: 600px) { #app { margin-top: 0; } }
