:root {
    --password-bg-deep: #5269cf;
    --password-bg-mid: #7798ef;
    --password-bg-soft: #9b83ea;
    --password-surface: rgba(255, 255, 255, 0.94);
    --password-text: #18223c;
    --password-muted: #66708a;
    --password-border: #cfd8eb;
    --password-primary: #496fee;
    --password-primary-dark: #3b58c7;
    --password-accent: #8b5cf6;
    --password-focus: #1565d8;
    --password-danger: #ba1a3a;
    --password-shadow: rgba(33, 48, 112, 0.32);
}

html,
body {
    min-height: 100%;
}

body.school-password-page {
    position: relative;
    min-width: 320px;
    margin: 0;
    overflow-x: hidden;
    color: var(--password-text);
    background:
        radial-gradient(circle at 14% 16%, rgba(198, 180, 255, 0.78), transparent 27%),
        radial-gradient(circle at 88% 12%, rgba(111, 218, 255, 0.58), transparent 29%),
        radial-gradient(circle at 52% 108%, rgba(167, 113, 248, 0.66), transparent 34%),
        linear-gradient(135deg, var(--password-bg-deep), var(--password-bg-mid) 52%, var(--password-bg-soft));
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.school-password-page::before,
body.school-password-page::after {
    content: "";
    position: fixed;
    z-index: 0;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    pointer-events: none;
}

body.school-password-page::before {
    width: 240px;
    height: 240px;
    left: -90px;
    bottom: 8%;
    background: rgba(224, 232, 255, 0.2);
    box-shadow: 0 0 68px rgba(225, 240, 255, 0.3);
}

body.school-password-page::after {
    width: 170px;
    height: 170px;
    right: -52px;
    top: 16%;
    background: rgba(213, 240, 255, 0.17);
    box-shadow: 0 0 58px rgba(211, 234, 255, 0.32);
}

.password-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: max(28px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.password-card {
    width: min(100%, 540px);
    box-sizing: border-box;
    padding: 38px 42px 34px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 28px;
    background: var(--password-surface);
    box-shadow: 0 28px 70px var(--password-shadow), inset 0 1px 0 #ffffff;
    -webkit-backdrop-filter: blur(22px) saturate(135%);
    backdrop-filter: blur(22px) saturate(135%);
}

.password-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    color: #ffffff;
    font-size: 27px;
    border: 1px solid rgba(255, 255, 255, 0.88);
    border-radius: 21px;
    background: linear-gradient(145deg, #167da4, var(--password-primary-dark) 52%, #6d3fc0);
    box-shadow: 0 13px 28px rgba(73, 111, 238, 0.28);
}

.password-kicker {
    margin: 0 0 5px;
    color: var(--password-primary-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-align: center;
}

.password-card h1 {
    margin: 0;
    color: var(--password-text);
    font-size: clamp(26px, 5vw, 32px);
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.password-help {
    max-width: 430px;
    margin: 12px auto 26px;
    color: var(--password-muted);
    font-size: 14px;
    line-height: 1.7;
    text-align: center;
}

.password-card form {
    display: grid;
    gap: 10px;
}

.password-card label {
    margin: 7px 0 0;
    color: #313c58;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
}

.password-card input {
    width: 100%;
    min-height: 50px;
    box-sizing: border-box;
    padding: 12px 14px;
    color: var(--password-text);
    font-size: 16px;
    line-height: 24px;
    border: 1px solid var(--password-border);
    border-radius: 13px;
    outline: 0;
    background: #ffffff;
    box-shadow: inset 0 1px 2px rgba(24, 34, 60, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.password-card input:hover {
    border-color: #aebbd6;
}

.password-card input:focus-visible {
    border-color: var(--password-focus);
    box-shadow: 0 0 0 3px rgba(21, 101, 216, 0.17);
}

.password-card input[aria-invalid="true"],
.password-card .has-error input {
    border-color: var(--password-danger);
    background: #fff8fa;
    box-shadow: 0 0 0 3px rgba(186, 26, 58, 0.12);
}

.password-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
}

.btn-send-code,
.btn-primary-action {
    min-height: 50px;
    box-sizing: border-box;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-send-code {
    min-width: 128px;
    padding: 0 18px;
    color: var(--password-primary-dark);
    border: 1px solid #becbf4;
    background: #eef2ff;
}

.btn-send-code:hover {
    border-color: #96aaf0;
    background: #e5ebff;
}

.btn-primary-action {
    min-height: 54px;
    margin-top: 12px;
    padding: 0 20px;
    color: #ffffff;
    font-size: 17px;
    letter-spacing: 0.04em;
    background: linear-gradient(105deg, #147ba2, var(--password-primary-dark) 48%, #6d3fc0);
    box-shadow: 0 12px 26px rgba(73, 111, 238, 0.26);
}

.btn-send-code:hover,
.btn-primary-action:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.btn-send-code:active,
.btn-primary-action:active {
    transform: translateY(1px);
}

.btn-send-code:focus-visible,
.btn-primary-action:focus-visible,
.password-secondary-link:focus-visible {
    outline: 3px solid var(--password-focus);
    outline-offset: 3px;
}

.btn-send-code:disabled,
.btn-primary-action:disabled {
    cursor: not-allowed;
    filter: grayscale(0.22);
    opacity: 0.58;
    transform: none;
}

.field-hint {
    margin: -3px 0 1px;
    color: var(--password-muted);
    font-size: 12px;
    line-height: 1.5;
}

.password-offline-help {
    margin: 24px 0 8px;
    padding: 13px 14px;
    color: #4f5670;
    font-size: 13px;
    line-height: 1.65;
    border: 1px solid #dce3f3;
    border-radius: 13px;
    background: #f7f9fe;
}

.password-secondary-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px auto 0;
    color: var(--password-primary-dark);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.password-secondary-link:hover {
    color: #283f9b;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 520px) {
    .password-shell {
        align-items: flex-start;
        padding-top: max(18px, env(safe-area-inset-top));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(18px, env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .password-card {
        padding: 28px 20px 24px;
        border-radius: 22px;
    }

    .password-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 14px;
        border-radius: 18px;
        font-size: 24px;
    }

    .password-help {
        margin-bottom: 21px;
        text-align: left;
    }

    .password-code-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .btn-send-code {
        width: 100%;
        min-height: 44px;
    }
}

@media (prefers-contrast: more) {
    .password-card,
    .password-card input,
    .btn-send-code,
    .password-offline-help {
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .password-card input,
    .btn-send-code,
    .btn-primary-action {
        scroll-behavior: auto;
        transition: none;
    }
}
