:root {
  --crema: #f6efe1;
  --crema2: #efe4cd;
  --teal: #1f5e63;
  --teal-osc: #163f43;
  --rust: #b5532f;
  --oro: #c8963e;
  --tinta: #2b2622;
  --suave: #6d6258;
  --radio: 18px;
  font-family: "Nunito", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--crema); color: var(--tinta); line-height: 1.5; }
a { color: var(--teal); }

header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem clamp(1rem, 4vw, 3rem); background: var(--teal); color: var(--crema);
}
header .marca { color: var(--crema); text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: .01em; display: inline-flex; align-items: center; gap: .55rem; }
header .marca img { width: 34px; height: 34px; border-radius: 9px; display: block; }
header .marca span { color: #f2c879; }
header .cuenta { display: flex; gap: .8rem; align-items: center; }
header .cuenta a, header .cuenta .link { color: var(--crema); }

main { max-width: 1100px; margin: 0 auto; padding: clamp(1rem, 4vw, 2.5rem); }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: .2rem 0 .3rem; color: var(--teal-osc); }
.intro { color: var(--suave); margin: 0 0 1.8rem; max-width: 46rem; }

.estante { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.6rem; }
.libro {
  background: #fff; border-radius: var(--radio); overflow: hidden;
  box-shadow: 0 2px 0 var(--crema2), 0 10px 24px rgba(43, 38, 34, .10);
  display: flex; flex-direction: column; transition: transform .15s;
}
.libro:hover { transform: translateY(-3px); }
.libro .tapa { position: relative; aspect-ratio: 3 / 4; background: var(--crema2); }
.libro .tapa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.etiqueta {
  position: absolute; top: .7rem; left: .7rem; padding: .2rem .7rem; border-radius: 99px;
  font-weight: 800; font-size: .85rem; background: var(--crema); color: var(--teal-osc);
}
.etiqueta.pago { background: var(--rust); color: #fff; }
.etiqueta.tuyo { background: #8a6420; color: #fff; }
.libro .datos { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.libro h2 { font-size: 1.15rem; margin: 0; color: var(--teal-osc); }
.libro p { margin: 0; font-size: .92rem; color: var(--suave); flex: 1; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }

button, .boton {
  font: inherit; font-weight: 800; border: 0; cursor: pointer; border-radius: 99px;
  padding: .6rem 1.1rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.pri { background: var(--rust); color: #fff; }
.pri:hover { background: #9c4526; }
.sec { background: var(--crema2); color: var(--teal-osc); }
.peq { padding: .4rem .9rem; font-size: .9rem; }
.link { background: none; padding: 0; text-decoration: underline; font-weight: 600; }
button:disabled { opacity: .6; cursor: wait; }

.seguro { margin: .1rem 0 0 !important; font-size: .78rem !important; color: var(--suave); flex: 0 !important; }
.bloqueo .seguro { margin-top: .7rem !important; }
.caja {
  margin-top: 2.5rem; padding: 1.3rem 1.4rem; border-radius: var(--radio);
  background: var(--crema2); display: flex; flex-wrap: wrap; gap: .8rem; align-items: end;
}
.caja h3 { margin: 0 0 .2rem; width: 100%; color: var(--teal-osc); }
input, select {
  font: inherit; padding: .55rem .8rem; border-radius: 12px; border: 2px solid #d8cbb2; background: #fff; min-width: 14rem;
}
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 700; font-size: .9rem; }

dialog { border: 0; border-radius: var(--radio); padding: 0; max-width: 26rem; width: calc(100% - 2rem); }
dialog::backdrop { background: rgba(22, 63, 67, .55); }
.login { padding: 1.5rem; display: flex; flex-direction: column; gap: .9rem; }
.login h2 { margin: 0; color: var(--teal-osc); }
.login .msg { margin: 0; color: var(--suave); }
.login { position: relative; }
.login .cerrar-x { position: absolute; top: .6rem; right: .6rem; width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%; background: var(--crema2); color: var(--teal-osc); font-size: 1.3rem; }
.login h2 { padding-right: 2.6rem; }
.login form { display: flex; flex-direction: column; gap: .8rem; }
.login [hidden] { display: none !important; }
.login input { min-width: 0; width: 100%; }
.pestanas { display: flex; gap: .3rem; background: var(--crema2); padding: .25rem; border-radius: 99px; }
.pestanas button { flex: 1; background: none; color: var(--teal-osc); padding: .5rem .6rem; font-size: .9rem; }
.pestanas button[aria-selected=true] { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.login .enlaces { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; font-size: .9rem; }
.login .enlaces .link { color: var(--teal); }
.nota-p { margin: 0; color: var(--suave); font-size: .92rem; }
.pasos { list-style: none; counter-reset: p; padding: 0; margin: -.6rem 0 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.pasos li { counter-increment: p; background: #fff; border-radius: 14px; padding: .8rem 1rem .8rem 3.1rem; position: relative; font-size: .95rem; color: var(--suave); box-shadow: 0 2px 0 var(--crema2); }
.pasos li::before { content: counter(p); position: absolute; left: .9rem; top: .8rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #8a6420; color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.pasos strong { color: var(--teal-osc); display: block; }
#intro .acciones { display: flex; margin-top: .6rem; }
.login .botones { display: flex; gap: .6rem; justify-content: flex-end; }
.login .ok { margin: 0; color: var(--teal); font-weight: 700; }

.aviso {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 50;
  padding: .8rem 1.2rem; border-radius: 14px; background: var(--teal-osc); color: #fff; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100% - 2rem);
}
.aviso.error { background: #8e2f1d; }

/* Lector */
body.lector { background: #111; }
.lector header { padding: .5rem 1rem; }
#visor { position: fixed; inset: 52px 0 0 0; }
#visor iframe { width: 100%; height: 100%; border: 0; background: #000; }
.cargando { color: var(--crema); text-align: center; padding: 4rem 1rem; }
.cargando .barra { width: min(320px, 80%); height: 8px; background: #333; border-radius: 99px; margin: 1rem auto; overflow: hidden; }
.cargando .barra div { height: 100%; width: 0; background: var(--oro); transition: width .2s; }
.bloqueo { max-width: 30rem; margin: 3rem auto; background: var(--crema); padding: 1.5rem; border-radius: var(--radio); text-align: center; }
.bloqueo img { width: 160px; border-radius: 12px; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--crema2); }
th { background: var(--teal); color: #fff; }
.mono { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .05em; }
footer { text-align: center; color: var(--suave); font-size: .85rem; padding: 2rem 1rem; }

/* Opiniones de papás */
.opinar { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-top: .3rem; }
.estado-op { font-size: .85rem; color: var(--suave); }
.estrellas { border: 0; padding: 0; margin: 0; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .15rem; }
.estrellas legend { font-weight: 700; font-size: .9rem; padding: 0; margin-bottom: .3rem; width: 100%; }
.estrellas input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.estrellas label { font-size: 2rem; line-height: 1; color: #c9bba3; cursor: pointer; padding: .1rem; display: inline; }
.estrellas input:checked ~ label, .estrellas label:hover, .estrellas label:hover ~ label { color: #b07a00; }
.estrellas input:focus-visible + label { outline: 3px solid var(--teal); border-radius: 6px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog textarea { font: inherit; padding: .55rem .8rem; border-radius: 12px; border: 2px solid #d8cbb2; background: #fff; width: 100%; resize: vertical; }
.cuenta-car { align-self: flex-end; font-size: .8rem; color: var(--suave); font-weight: 600; }
label.casilla { flex-direction: row; align-items: flex-start; gap: .5rem; font-weight: 600; }
label.casilla input { min-width: 0; width: auto; margin-top: .25rem; }
/* admin: opiniones */
.op-admin { background: #fff; border-radius: 14px; padding: .8rem 1rem; margin-bottom: .7rem; box-shadow: 0 2px 0 var(--crema2); }
.op-admin .cab { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; font-size: .9rem; color: var(--suave); }
.op-admin .est { color: #8a5a00; font-size: 1.05rem; letter-spacing: 1px; }
.op-admin p { margin: .3rem 0 .5rem; }
.op-admin .estado { font-weight: 800; }
.op-admin .estado.pendiente { color: #8e2f1d; } .op-admin .estado.aprobada { color: #2f6b45; }

/* el atributo hidden siempre gana (antes .caja{display:flex} lo pisaba) */
[hidden] { display: none !important; }

/* Página /entrar.html (formulario normal para que los gestores de contraseñas lo rellenen) */
main.entrar { max-width: 30rem; }
.tarjeta-entrar { background: #fff; border-radius: var(--radio); box-shadow: 0 2px 0 var(--crema2), 0 10px 24px rgba(43, 38, 34, .10); margin-top: clamp(.5rem, 4vh, 2.5rem); }
.tarjeta-entrar h1 { font-size: clamp(1.5rem, 5vw, 2rem); margin: 0; }
.tarjeta-entrar form label { margin-bottom: -.5rem; }
.tarjeta-entrar .volver { margin: 0; font-size: .92rem; }
