* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(160deg, #2b2f77 0%, #1a1c3a 100%);
    color: #1a1a2e;
    min-height: 100vh;
}

.contenedor { max-width: 640px; margin: 0 auto; padding: 24px 16px 60px; }
.contenedor.centrado { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }

h1 { color: #ffcb05; text-shadow: 2px 2px 0 #2a3095; font-size: 1.6rem; margin-bottom: 4px; }
.logo-portada { max-width: 320px; width: 100%; display: block; margin: 0 auto 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.subtitulo { color: #d7d9ff; margin-top: 0; }

.cabecera { display: flex; justify-content: space-between; align-items: center; }
.cabecera h1 { margin: 0; font-size: 1.3rem; }
.mi-usuario { background: #ffe1e1; color: #a30000; border: 2px solid #ff4d4d; border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; font-weight: 600; margin: 8px 0 12px; }

.tarjeta {
    background: #ffffff; border-radius: 16px; padding: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 16px;
}
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .dos-col { grid-template-columns: 1fr; } }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; }

input[type="text"], input[type="password"], input[type="number"], select {
    padding: 10px 12px; border-radius: 10px; border: 1px solid #ccc; font-size: 1rem;
}

button {
    background: #ffcb05; color: #1a1a2e; border: none; padding: 12px 18px;
    border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer;
}
button.secundario { background: #eee; }
button.pequeno { padding: 8px 12px; font-size: 0.85rem; }
button.masterball { background: #8e44ad; color: white; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.error { color: #ff6b6b; font-weight: 600; }
.mensaje { padding: 10px 14px; border-radius: 10px; text-align: center; font-weight: 600; }
.mensaje-info { background: #ffffff22; color: #ffffff; }
.mensaje-exito { background: #2ecc71; color: white; }
.mensaje-fallo { background: #e74c3c; color: white; }

.enlace-secundario { text-align: center; }
.enlace-secundario a { color: #d7d9ff; margin: 0 4px; }

.progreso { margin: 18px 0; color: #ffffff; }
.barra { background: #ffffff33; border-radius: 20px; height: 14px; overflow: hidden; }
.barra-relleno { background: #ffcb05; height: 100%; }

.sprite { width: 120px; image-rendering: pixelated; }
.tier-legendario { color: #B8860B; font-weight: 700; }
.tier-raro { color: #E3350D; font-weight: 700; }
.tier-pococomun { color: #3B6FBF; font-weight: 700; }
.tier-comun { color: #4F9A5C; font-weight: 700; }

.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; margin-top: 12px; }
.titulo-rejilla { color: #ffcb05; text-align: center; margin: 24px 0 4px; }
.celda { background: #ffffff11; border-radius: 8px; padding: 4px; position: relative; }
.celda img { width: 100%; }
.celda.pendiente img { filter: brightness(0) saturate(100%); opacity: 0.35; }
.contador-dup { position: absolute; bottom: 2px; right: 4px; font-size: 0.65rem; background: #1a1a2e; color: #ffcb05; padding: 0 4px; border-radius: 6px; }

.tabla { width: 100%; border-collapse: collapse; background: #ffffff; border-radius: 12px; overflow: hidden; }
.tabla th, .tabla td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.tabla tr.ganador { background: #fff6cc; font-weight: 700; }

.lista-requisitos { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.nota { font-size: 0.8rem; color: #777; margin: 4px 0; }
.aviso-usuario {
    background: #ffe1e1;
    color: #a30000;
    border: 2px solid #ff4d4d;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 8px 0;
    text-align: center;
}
.ya-hecho { color: #2ecc71; font-weight: 600; }

.fila-reto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fila-reto span { flex: 1; font-size: 0.9rem; }
.fila-intercambio { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #eee; }
.fila-intercambio:last-child { border-bottom: none; }

.codigo { font-family: monospace; font-size: 1.4rem; font-weight: 700; background: #f5f5f5; padding: 6px 10px; border-radius: 8px; text-align: center; }
.enlace-copiable { font-family: monospace; font-size: 0.75rem; background: #f5f5f5; padding: 6px 10px; border-radius: 8px; word-break: break-all; }
