/* 科创学习中心：独立登录页（不继承 FTC base.html） */
:root {
    --ink: #071313;
    --panel: #0b2020;
    --line: rgba(156, 226, 207, .16);
    --mint: #72e0bc;
    --cyan: #83d3e2;
    --text: #eff9f4;
    --muted: #a0b9b1;
    --error: #ff8a8a;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body.login-page {
    margin: 0;
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(ellipse at 12% 0%, rgba(67, 168, 133, .2), transparent 40%),
        radial-gradient(ellipse at 92% 30%, rgba(54, 127, 152, .14), transparent 36%),
        var(--ink);
    line-height: 1.6;
}

.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .18;
    background-image:
        linear-gradient(rgba(180, 240, 215, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(180, 240, 215, .035) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: linear-gradient(#000, transparent 72%);
}

.bg-orb {
    position: fixed;
    width: 30rem;
    height: 30rem;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .12;
    pointer-events: none;
}

.bg-orb--mint { background: #28c58c; top: -22rem; left: -9rem; }
.bg-orb--cyan { background: #27a6cf; bottom: -24rem; right: -20rem; }

.login-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px clamp(18px, 5vw, 64px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(114, 224, 188, .45);
    border-radius: 12px;
    color: var(--mint);
    background: rgba(114, 224, 188, .1);
    font-size: 22px;
}

.brand__text strong,
.brand__text em { display: block; }

.brand__text strong { font-size: 15px; letter-spacing: .04em; }
.brand__text em { font-style: normal; font-size: 11px; color: var(--muted); }

.login-main {
    position: relative;
    display: grid;
    place-items: center;
    min-height: calc(100vh - 76px);
    padding: 12px clamp(16px, 5vw, 56px) 48px;
}

.login-card {
    display: grid;
    grid-template-columns: 1.02fr 1fr;
    width: min(100%, 980px);
    min-height: 500px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(150deg, rgba(15, 42, 39, .96), rgba(8, 25, 26, .96));
    box-shadow: 0 32px 90px rgba(0, 0, 0, .34);
}

/* ---------- 围观席 ---------- */
.crowd-stage {
    --look-x: 0px;
    --look-y: 0px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 26px 24px 20px;
    background:
        radial-gradient(circle at 24% 14%, rgba(114, 224, 188, .12), transparent 55%),
        radial-gradient(circle at 82% 82%, rgba(131, 211, 226, .1), transparent 52%),
        linear-gradient(160deg, #0f2d2a, #0a1d1f);
    border-right: 1px solid var(--line);
}

.crowd-head { position: relative; z-index: 2; }

.crowd-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: 1px solid rgba(114, 224, 188, .24);
    border-radius: 999px;
    background: rgba(114, 224, 188, .08);
    color: var(--mint);
    font-size: 12px;
    letter-spacing: .1em;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 12px var(--mint);
}

.crowd-line {
    margin: 12px 0 0;
    color: #d6e8e1;
    font-size: 14px;
    transition: opacity .2s ease;
}

.crowd-scene {
    position: relative;
    flex: 1;
    min-height: 260px;
    margin-top: 10px;
    font-size: clamp(10px, 1.7vw, 15px);
}

.crowd-shadow {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 3%;
    height: 12%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, .45), transparent 70%);
    filter: blur(6px);
}

.crowd-character {
    position: absolute;
    bottom: 10%;
    box-shadow: 0 18px 28px rgba(0, 0, 0, .28);
    animation: crowd-idle 4s ease-in-out infinite;
    transform-origin: 50% 100%;
    transition: transform .26s ease, filter .26s ease;
}

.char-purple {
    --face-top: 13%;
    --eye-scale: 1;
    z-index: 2;
    left: 24%;
    bottom: 12%;
    width: 7.6em;
    height: 12.4em;
    border-radius: 2em 2.3em 1.4em 1.2em;
    transform: rotate(-5deg);
    background: linear-gradient(160deg, #7de3c0, #2fa77d);
}

.char-black {
    --face-top: 16%;
    --eye-scale: .8;
    z-index: 3;
    left: 42%;
    bottom: 7%;
    width: 5.4em;
    height: 9.1em;
    border-radius: 1em 1.4em 1.6em .9em;
    transform: rotate(3deg);
    background: linear-gradient(165deg, #16332f, #081a1a);
    animation-delay: .5s;
}

.char-orange {
    --face-top: 34%;
    --eye-scale: 1.25;
    z-index: 4;
    left: 1%;
    bottom: 3%;
    width: 9.4em;
    height: 6.7em;
    border-radius: 999px 999px 1.7em 1.7em;
    transform: rotate(0deg);
    background: linear-gradient(160deg, #ffc56b, #f39433);
    animation-delay: 1s;
}

.char-yellow {
    --face-top: 30%;
    --eye-scale: 1.1;
    z-index: 1;
    right: 6%;
    width: 6.3em;
    height: 9.8em;
    border-radius: 6.3em 6.3em 1.9em 1.9em;
    transform: rotate(4deg);
    background: linear-gradient(160deg, #ffe073, #efb03a);
    animation-delay: 1.3s;
}

.char-black .eye { width: 1.1em; height: 1.1em; }
.char-black .pupil { width: .48em; height: .48em; }

.eye {
    position: absolute;
    top: var(--face-top);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45em;
    height: 1.45em;
    border-radius: 50%;
    background: #f7fffb;
    transition: width .2s ease, height .2s ease, background .2s ease, transform .2s ease;
}

.eye.left { left: 28%; }
.eye.right { right: 28%; }

.char-orange .eye { top: 30%; }
.char-orange .eye.left { left: 20%; }
.char-orange .eye.right { right: 20%; }

.pupil {
    width: .58em;
    height: .58em;
    border-radius: 50%;
    background: #0c2020;
    transform: translate(
        calc(var(--look-x) * var(--eye-scale)),
        calc(var(--look-y) * var(--eye-scale))
    );
    transition: transform .1s linear, opacity .16s ease;
}

.brow {
    position: absolute;
    top: calc(var(--face-top) - 14%);
    width: 1.2em;
    height: .28em;
    border-radius: 999px;
    background: rgba(8, 30, 28, .45);
    transition: transform .2s ease, opacity .18s ease;
}

.brow.left { left: 27%; }
.brow.right { right: 27%; }

.mouth {
    position: absolute;
    top: calc(var(--face-top) + 30%);
    left: 50%;
    width: 1.5em;
    height: .6em;
    border-bottom: .16em solid rgba(8, 30, 28, .5);
    border-radius: 0 0 1.4em 1.4em;
    transform: translateX(-50%);
    transition: all .2s ease;
}

/* 密码模式：全员转头、闭眼 */
.crowd-stage[data-state="password"] .crowd-character {
    animation-play-state: paused;
    translate: 0 0;
}

.crowd-stage[data-state="password"] .char-purple { transform: rotate(-14deg); }
.crowd-stage[data-state="password"] .char-black { transform: rotate(-11deg); }
.crowd-stage[data-state="password"] .char-orange { transform: rotate(-8deg); }
.crowd-stage[data-state="password"] .char-yellow { transform: rotate(-13deg); }

.crowd-stage[data-state="password"] .eye {
    width: 1.6em;
    height: .34em;
    background: transparent;
    border-top: .22em solid rgba(8, 30, 28, .62);
    border-radius: 999px;
    transform: translateY(.2em);
}

.crowd-stage[data-state="password"] .pupil,
.crowd-stage[data-state="password"] .brow,
.crowd-stage[data-state="password"] .mouth { opacity: 0; }

/* 登录失败：皱眉、撇嘴、抖动 */
.crowd-stage[data-state="failed"] .brow.left { transform: rotate(23deg) translateY(.15em); }
.crowd-stage[data-state="failed"] .brow.right { transform: rotate(-23deg) translateY(.15em); }

.crowd-stage[data-state="failed"] .mouth {
    border-bottom: 0;
    border-top: .16em solid rgba(8, 30, 28, .5);
    border-radius: 1.4em 1.4em 0 0;
    top: calc(var(--face-top) + 34%);
}

.crowd-stage[data-state="failed"] .crowd-scene {
    animation: crowd-shake .42s ease-in-out 2;
}

/* 登录中：抬眼看、嘟嘴 */
.crowd-stage[data-state="thinking"] .brow { transform: translateY(-.22em); }
.crowd-stage[data-state="thinking"] .mouth {
    width: .7em;
    height: .7em;
    border: .14em solid rgba(8, 30, 28, .5);
    border-radius: 50%;
}
.crowd-stage[data-state="thinking"] .crowd-character { animation-duration: 2.2s; }
.crowd-stage[data-state="thinking"] .pupil { --look-y: -2px; }

/* 登录成功：笑眼 */
.crowd-stage[data-state="success"] .eye {
    width: 1.5em;
    height: .62em;
    background: transparent;
    border-radius: 999px 999px 0 0;
    border-top: .2em solid #0c2020;
}

.crowd-stage[data-state="success"] .pupil { opacity: 0; }

.crowd-stage[data-state="success"] .mouth {
    width: 1.8em;
    height: .9em;
    border-bottom: .2em solid rgba(8, 30, 28, .6);
}

.crowd-foot {
    position: relative;
    z-index: 2;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* ---------- 登录表单 ---------- */
.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(24px, 4vw, 42px);
    background: linear-gradient(170deg, rgba(9, 28, 29, .98), rgba(7, 22, 24, .98));
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--mint);
    font-size: 12px;
    letter-spacing: .1em;
}

.login-panel h1 {
    margin: 14px 0 8px;
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.3;
    letter-spacing: -.02em;
}

.login-subtitle {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

#login-form { display: grid; gap: 16px; }

.field { display: grid; gap: 7px; color: #d6e8e1; font-size: 13px; }

.field input {
    width: 100%;
    padding: 12px 13px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0e2928;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field input::placeholder { color: #6f8c84; }

.field input:focus {
    border-color: var(--mint);
    box-shadow: 0 0 0 3px rgba(114, 224, 188, .12);
}

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 66px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.password-toggle:hover { color: var(--text); }

.btn-submit {
    min-height: 48px;
    margin-top: 2px;
    border: 0;
    border-radius: 11px;
    color: #06231c;
    background: linear-gradient(115deg, var(--mint), var(--cyan));
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(88, 215, 175, .2); }
.btn-submit:disabled { opacity: .6; cursor: wait; transform: none; }

.login-feedback {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.login-feedback.is-error { color: var(--error); font-weight: 700; }
.login-feedback.is-success { color: var(--mint); font-weight: 700; }
.login-feedback.is-loading { color: #9fd7e6; }

.login-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.login-foot a { color: var(--mint); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

@keyframes crowd-idle {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -.3em; }
}

@keyframes crowd-shake {
    0%, 100% { translate: 0 0; }
    25% { translate: -.45em 0; }
    75% { translate: .45em 0; }
}

@media (max-width: 860px) {
    .login-card { grid-template-columns: 1fr; min-height: 0; }
    .crowd-stage { border-right: 0; border-bottom: 1px solid var(--line); }
    .crowd-scene { min-height: 210px; }
    .crowd-foot { display: none; }
}

@media (max-width: 520px) {
    .login-top { padding: 12px 16px; }
    .brand__text em { display: none; }
    .login-main { min-height: 0; padding: 4px 12px 32px; }
    .login-card { border-radius: 18px; }
    .crowd-stage { padding: 18px 16px 14px; }
    .crowd-scene { min-height: 185px; font-size: 9px; }
    .login-panel { padding: 22px 18px 26px; }
    .login-subtitle { margin-bottom: 18px; }
    .login-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
