/* ===========================================================================
   RedoSchool — экран входа (логин).
   Космический фон в стиле игры, стеклянная карточка, бренд-кнопка.
   Разметка — #auth-gate в index.html, логика — auth.js.
   =========================================================================== */

.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 28px;
    overflow: hidden;
    background-color: #1a2160;
    background-image:
        radial-gradient(120% 120% at 50% 10%, rgba(24, 33, 92, 0) 45%, rgba(8, 12, 40, 0.72) 100%),
        url("loading/bg.jpg");
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
}

.auth-gate[hidden] {
    display: none;
}

.auth-scene {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.auth-star {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px 2px rgba(180, 226, 255, 0.9);
    animation: auth-twinkle 3.6s ease-in-out infinite;
}

.auth-star-1 { left: 24%; top: 26%; animation-delay: 0s; }
.auth-star-2 { left: 74%; top: 30%; animation-delay: 1.2s; transform: scale(1.3); }
.auth-star-3 { left: 62%; top: 68%; animation-delay: 2.3s; transform: scale(0.7); }

.auth-card {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 30px 30px 26px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(28, 40, 96, 0.82), rgba(14, 21, 58, 0.9));
    border: 1.5px solid rgba(150, 190, 255, 0.32);
    box-shadow:
        0 26px 60px rgba(5, 9, 34, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: auth-card-in 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-logo {
    width: clamp(150px, 46%, 210px);
    height: auto;
    margin: -6px auto 8px;
    filter: drop-shadow(0 8px 18px rgba(6, 12, 44, 0.5));
    animation: auth-logo-wobble 4.4s ease-in-out infinite;
    pointer-events: none;
    -webkit-user-drag: none;
}

.auth-title {
    margin: 4px 0 2px;
    text-align: center;
    color: #ffffff;
    font: 900 26px/1.15 inherit;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    margin: 0 0 22px;
    text-align: center;
    color: var(--rs-muted);
    font: 600 14px/1.35 inherit;
}

.auth-field {
    display: grid;
    gap: 7px;
    margin: 0 0 16px;
}

.auth-label {
    color: #c9d8ff;
    font: 700 12px/1.2 inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-left: 2px;
}

.auth-field input {
    width: 100%;
    height: 50px;
    box-sizing: border-box;
    border: 1.5px solid rgba(150, 190, 255, 0.28);
    border-radius: 14px;
    padding: 0 16px;
    color: #ffffff;
    background: rgba(10, 16, 46, 0.6);
    outline: none;
    font: 600 16px/1.2 inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-field input::placeholder {
    color: rgba(169, 184, 230, 0.55);
    font-weight: 500;
}

.auth-field input:focus {
    border-color: var(--rs-orange);
    background: rgba(10, 16, 46, 0.85);
    box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.16);
}

.auth-submit {
    position: relative;
    width: 100%;
    height: 52px;
    margin-top: 6px;
    border: 0;
    border-radius: 14px;
    color: #ffffff;
    background: linear-gradient(180deg, var(--rs-orange-hi), var(--rs-orange) 55%, var(--rs-orange-lo));
    cursor: pointer;
    font: 800 17px/1 inherit;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 22px rgba(244, 98, 10, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: transform 120ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.auth-submit:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 14px 28px rgba(244, 98, 10, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.auth-submit:active:not(:disabled) {
    transform: translateY(2px);
}

.auth-submit:disabled {
    cursor: progress;
}

.auth-submit.is-busy .auth-submit-label {
    visibility: hidden;
}

.auth-submit-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    opacity: 0;
}

.auth-submit.is-busy .auth-submit-spinner {
    opacity: 1;
    animation: auth-spin 0.7s linear infinite;
}

.auth-error {
    min-height: 20px;
    margin-top: 14px;
    text-align: center;
    color: #ffb0b0;
    font: 600 13px/1.35 inherit;
}

@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(22px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-logo-wobble {
    0%, 100% { transform: rotate(-2.5deg) scale(1); }
    50%      { transform: rotate(2.5deg) scale(1.05); }
}

@keyframes auth-twinkle {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 1; }
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .auth-card { padding: 24px 22px 22px; border-radius: 22px; }
    .auth-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card, .auth-logo, .auth-star { animation: none !important; }
}
