:root {
  --fondo: #f4f1ea; --texto: #1c1b19; --acento: #8c3b2e; --acento-oscuro: #6f2e24; --apoyo: #c9bfae; --suave: #6b665c;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden;
  background: var(--fondo); color: var(--texto);
  font-family: 'Inter Tight', 'Inter', system-ui, sans-serif;
}

/* Fondo: anillos finos, el logo muy tenue y papel. Todo en tonos de la marca, sin degradados de colores. */
.fondo { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.fondo::before {
  content: ''; position: absolute; inset: -20%;
  background: repeating-radial-gradient(circle at 78% 18%, rgba(140, 59, 46, .07) 0 1px, transparent 1px 64px);
  animation: deriva 40s ease-in-out infinite alternate;
}
.fondo::after {
  content: ''; position: absolute; right: -8vmin; bottom: -10vmin; width: 78vmin; height: 78vmin;
  background: url('/acceso/logo.png') center / contain no-repeat; opacity: .06; transform: rotate(-8deg);
  animation: flotar 22s ease-in-out infinite alternate;
}
/* Textura de papel */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .48  0 0 0 0 .36  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@keyframes deriva { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-2.5%, 2%, 0); } }
@keyframes flotar { from { transform: rotate(-8deg) translate3d(0, 0, 0); } to { transform: rotate(-6deg) translate3d(-1.5vmin, 1vmin, 0); } }
@keyframes entrar { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

main {
  position: relative; z-index: 2; width: min(92vw, 400px); padding: 36px 32px 30px;
  background: rgba(255, 255, 255, .86); border: 1px solid var(--apoyo); border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 24px 60px -30px rgba(28, 27, 25, .35);
  backdrop-filter: blur(3px);
  animation: entrar .8s cubic-bezier(.2, .7, .2, 1) both;
  text-align: center;
}
.logo { display: block; width: 84px; height: auto; margin: 0 auto 14px; mix-blend-mode: multiply; }
h1 {
  font-family: 'Roboto Serif', Georgia, serif; font-weight: 500; font-size: 30px; line-height: 1.15;
  margin: 0 0 10px; letter-spacing: -.2px;
}
h1 span { color: var(--acento); font-style: italic; }
.linea { width: 44px; height: 2px; margin: 0 auto 14px; background: var(--acento); border-radius: 2px; }
#ayuda { margin: 0 0 22px; color: var(--suave); line-height: 1.45; font-size: 15px; min-height: 2.9em; }

form { text-align: left; }
label { display: block; margin: 0 0 14px; font-size: 13px; color: var(--suave); letter-spacing: .2px; }
input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; font-size: 15px; color: var(--texto);
  background: #fffdf8; border: 1px solid var(--apoyo); border-radius: 8px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px rgba(140, 59, 46, .14); }
button {
  width: 100%; margin-top: 6px; padding: 12px; font: inherit; font-size: 15px; font-weight: 600; letter-spacing: .2px;
  border: 0; border-radius: 8px; background: var(--acento); color: #fff; cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
button:hover { background: var(--acento-oscuro); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: default; }
#error { color: var(--acento); min-height: 1.4em; margin: 14px 0 0; font-size: 14px; text-align: center; }
[hidden] { display: none !important; }

.pie { position: relative; z-index: 2; margin-top: 22px; font-size: 12.5px; color: var(--suave); text-align: center; letter-spacing: .2px; }
.pie a { color: var(--suave); text-decoration: none; border-bottom: 1px solid var(--apoyo); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 420px) {
  main { padding: 28px 22px 24px; }
  h1 { font-size: 26px; }
}

/* Código de 6 cifras: una casilla por dígito */
.cod { margin: 0 0 14px; }
.etq { display: block; font-size: 13px; color: var(--suave); margin-bottom: 8px; letter-spacing: .2px; }
.cajas { display: flex; gap: 8px; justify-content: center; }
.digito {
  width: 46px; margin: 0; padding: 10px 0; text-align: center; font-size: 22px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Pantallas bajas (móvil en horizontal, como la app): todo más compacto y, si aun así no cabe
   (teclado abierto, código QR del 2FA), la página se desplaza para llegar siempre al botón. */
@media (max-height: 600px) {
  html, body { height: auto; }
  body {
    min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto;
    place-items: center; align-content: center; padding: 10px 0 12px;
  }
  main { padding: 16px 26px 12px; }
  .logo { width: 44px; margin-bottom: 4px; }
  h1 { font-size: 21px; margin-bottom: 6px; }
  .linea { margin-bottom: 6px; }
  #ayuda { font-size: 13.5px; margin-bottom: 10px; min-height: 0; line-height: 1.35; }
  label { margin-bottom: 8px; font-size: 12.5px; }
  input { margin-top: 4px; padding: 8px 12px; font-size: 15px; }
  button { margin-top: 2px; padding: 10px; }
  #error { margin-top: 6px; min-height: 1.2em; font-size: 13px; }
  .pie { margin-top: 8px; font-size: 12px; }
  #configurar img { width: 150px; height: 150px; }
  .cod { margin-bottom: 8px; }
  .digito { padding: 7px 0; font-size: 19px; }
}
