/* ==========================================================================
   Pantallas de la aplicación: ingreso, registro, mis libros y saludo
   ========================================================================== */

/* Fondo de las pantallas de entrada */
body.is-gate {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 216, 102, .35), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(77, 171, 247, .30), transparent 45%),
    linear-gradient(160deg, #1d2b53 0%, #283c78 55%, #34508f 100%);
}
.screen[hidden], #v-ficha[hidden] { display: none !important; }

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px;
}
.gate-logo { width: 120px; filter: brightness(1.35) drop-shadow(0 6px 16px rgba(0, 0, 0, .35)); }
.gate-title {
  margin: 0 0 6px;
  font: 800 clamp(2rem, 6vw, 2.8rem)/1 "Baloo 2", "Montserrat", sans-serif;
  color: #fff;
  letter-spacing: .01em;
}
.gate-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px 20px;
  border-radius: 26px;
  background: #fffdf7;
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .6);
  animation: gate-in .5s cubic-bezier(.3, 1.4, .5, 1);
}
.gate-card[hidden] { display: none; }
.gate-card.wide { width: min(640px, 100%); }
@keyframes gate-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.gate-label { margin: 0; font: 800 1.15rem/1.3 "Baloo 2", "Montserrat", sans-serif; color: #1c2433; text-align: center; }
.gate-help { margin: 0; font-size: .8rem; color: #6b7385; text-align: center; }
.gate-msg { min-height: 1.2em; margin: 0; font: 700 .9rem "Montserrat", sans-serif; color: #d43a3a; text-align: center; }
.gate-msg:empty { min-height: 0; }
.gate-hello { margin: 0; font: 800 1.5rem/1.2 "Baloo 2", "Montserrat", sans-serif; text-align: center; color: #1c2433; }

.code-input {
  width: 100%;
  padding: 14px 10px;
  border: 0;
  border-radius: 18px;
  background: #f1eee4;
  font: 800 clamp(1.7rem, 7vw, 2.2rem)/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .14em;
  text-align: center;
  color: #1c2433;
  box-shadow: inset 0 -4px 0 #e2dccb;
}
.code-input::placeholder { color: #c8c1ae; }
.code-input:focus { outline: 3px solid #4d7cfe; outline-offset: 2px; background: #fff; }

.big-btn {
  padding: 15px 20px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffb703, #fb8500);
  color: #1c1300;
  font: 800 1.25rem/1 "Baloo 2", "Montserrat", sans-serif;
  cursor: pointer;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .16), 0 12px 24px -12px rgba(251, 133, 0, .9);
  transition: transform .15s, filter .15s;
}
.big-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.big-btn:active { transform: translateY(1px); }
.big-btn:focus-visible { outline: 3px solid #4d7cfe; outline-offset: 3px; }
.big-btn.is-loading, .big-btn:disabled { opacity: .7; cursor: progress; }
.link-btn {
  align-self: center;
  padding: 4px 8px;
  border: 0;
  background: none;
  font: 700 .9rem "Montserrat", sans-serif;
  color: #3d5bd9;
  text-decoration: underline;
  cursor: pointer;
}

/* Registro */
.reg-book { display: flex; align-items: center; gap: 16px; padding-bottom: 6px; }
.reg-book img { width: 86px; border-radius: 4px 10px 10px 4px; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .5); }
.reg-kicker { margin: 0; font: 700 .85rem "Montserrat", sans-serif; color: #6b7385; }
.reg-book h2 { margin: 2px 0 4px; font: 700 1.6rem/1.1 "Fraunces", Georgia, serif; color: #1c2433; }
.reg-note { margin: 0; font-size: .82rem; color: #2f7d4a; font-weight: 600; }
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reg-grid label { display: flex; flex-direction: column; gap: 6px; font: 700 .85rem "Montserrat", sans-serif; color: #3a4252; }
.reg-grid input, .reg-grid select {
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: #f1eee4;
  font: 600 1rem "Montserrat", sans-serif;
  color: #1c2433;
}
.reg-grid input:focus, .reg-grid select:focus { outline: 3px solid #4d7cfe; background: #fff; }
@media (max-width: 560px) { .reg-grid { grid-template-columns: 1fr; } }

/* Usuario en la ficha */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar .back[hidden] { display: none; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px 4px 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  font: 600 .9rem "Montserrat", sans-serif;
  backdrop-filter: blur(8px);
}
.user-out {
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #1c2433;
  font: 700 .8rem "Montserrat", sans-serif;
  cursor: pointer;
}
.user-out:hover { background: #fff; }
.chip-date { background: rgba(0, 0, 0, .28) !important; }
@media (max-width: 640px) {
  .user-hi { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Mis libros (docentes) */
.shelf-wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 56px; color: #fff; }
.shelf-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.shelf-logo { width: 74px; filter: brightness(1.35); }
.shelf-title { margin: 0; font: 800 clamp(2rem, 5vw, 2.8rem)/1 "Baloo 2", "Montserrat", sans-serif; }
.shelf-sub { margin: 6px 0 22px; opacity: .85; font-weight: 600; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; }
.shelf-book {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.shelf-book:hover { transform: translateY(-6px) rotate(-1deg); }
.shelf-book:focus-visible { outline: 3px solid #ffd166; outline-offset: 6px; border-radius: 10px; }
.shelf-cover {
  aspect-ratio: 2 / 3;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 20px 34px -18px rgba(0, 0, 0, .8), inset 4px 0 8px rgba(0, 0, 0, .2);
}
.shelf-cover img { width: 100%; height: 100%; object-fit: cover; }
.shelf-badge {
  align-self: flex-start;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--st-ui);
  color: var(--st-ink);
  font: 700 .72rem "Montserrat", sans-serif;
}
.shelf-book strong { font: 700 1.05rem/1.2 "Fraunces", Georgia, serif; }
.shelf-book small { opacity: .75; font-size: .78rem; }
.user-chip.dark { margin-left: 0; }

/* Saludo al entrar */
.hello {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 22, 45, .55);
  backdrop-filter: blur(6px);
  animation: hello-bg .3s ease-out;
  transition: opacity .4s;
}
.hello[hidden] { display: none; }
.hello.is-out { opacity: 0; }
@keyframes hello-bg { from { opacity: 0; } }
.hello-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 40px;
  border-radius: 28px;
  background: #fffdf7;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
  animation: gate-in .5s cubic-bezier(.3, 1.6, .5, 1);
}
.hello-wave { font-size: 3.6rem; line-height: 1; display: inline-block; transform-origin: 70% 80%; animation: wave 1s ease-in-out 2; }
@keyframes wave { 20%, 60% { transform: rotate(18deg); } 40%, 80% { transform: rotate(-10deg); } }
.hello-card p { margin: 0; font: 800 clamp(1.5rem, 5vw, 2.1rem)/1.1 "Baloo 2", "Montserrat", sans-serif; color: #1c2433; text-align: center; }

.shake { animation: act-shake .45s; }
@keyframes act-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  .gate-card, .hello, .hello-card, .hello-wave { animation: none !important; }
}

/* Libro sin reseña todavía */
.synopsis p.synopsis-empty { color: #6b7385; font-style: italic; }
.synopsis p.synopsis-empty::first-letter { float: none; font: inherit; color: inherit; padding: 0; }

.vivo-link { display: inline-flex; margin-top: 10px; padding: 9px 16px; border-radius: 999px; background: linear-gradient(180deg, #ffb703, #fb8500); color: #1c1300; font: 800 .95rem "Baloo 2", sans-serif; text-decoration: none; }
