@charset "utf-8";

/* 个人中心背景页（与 profile.html 一致，作为 login.jpg 底层） */
.login-page .profile-hero,
.login-page .profile-stats {
    pointer-events: none;
    user-select: none;
}

.login-page .profile-stats {
    margin: 0 0.12rem;
    padding: 0.16rem 0.12rem;
    max-height: calc(100vh - var(--header-height) - var(--nav-height) - 2rem);
    overflow: hidden;
}

/* 登录弹窗遮罩：header 与 bottom-nav 之间垂直水平居中 */
.login-overlay {
    position: fixed;
    top: var(--header-height);
    bottom: var(--nav-height);
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.12rem;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.45);
}

/*
 * d20.png 976×615 切图像素锚点（白框内内容区）
 * - 标题栏：0 ~ 13.66%
 * - 米色内容区：13.82% ~ 97.24%（左右约 4.5% 避开四角装饰）
 */
.login-panel {
    --d20-aspect: 976 / 615;
    --login-header-h: 13.66%;
    --login-cream-top: 13.82%;
    --login-cream-bottom: 2.76%;
    --login-cream-x: 4.5%;

    --login-overlay-h: calc(100vh - var(--header-height) - var(--nav-height));
    --login-overlay-w: calc(100vw - 0.24rem);

    position: relative;
    width: min(var(--login-overlay-w), calc(var(--login-overlay-h) * 976 / 615));
    aspect-ratio: var(--d20-aspect);
    max-width: 100%;
    max-height: 100%;
    flex-shrink: 1;
    min-height: 0;
    overflow: hidden;
    container-type: size;
    container-name: login-panel;
    filter: drop-shadow(0 0.04rem 0.16rem rgba(0, 0, 0, 0.35));
}

.login-panel-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.login-panel-body {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.login-panel-title {
    position: absolute;
    top: 0;
    left: var(--login-cream-x);
    right: var(--login-cream-x);
    height: var(--login-header-h);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 2%;
    box-sizing: border-box;
    font-size: clamp(0.12rem, 3.4cqh, 0.18rem);
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.25;
    letter-spacing: 0.01rem;
}

/* 米色白框内容区：按切图百分比定位，内部元素随弹窗高度缩放 */
.login-panel-main {
    position: absolute;
    left: var(--login-cream-x);
    right: var(--login-cream-x);
    top: var(--login-cream-top);
    bottom: var(--login-cream-bottom);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: clamp(0.03rem, 1.1cqh, 0.08rem);
    overflow: hidden;
    box-sizing: border-box;
    min-height: 0;
}

.login-field {
    width: 100%;
    flex-shrink: 1;
    min-height: 0;
}

.login-field + .login-field {
    margin-top: 0;
}

.login-field label {
    display: block;
    margin-bottom: clamp(0.02rem, 0.6cqh, 0.05rem);
    font-size: clamp(0.1rem, 2.2cqh, 0.13rem);
    font-weight: 700;
    color: #5a3e2b;
    text-align: left;
    line-height: 1.2;
}

.login-field input {
    display: block;
    width: 100%;
    height: clamp(0.28rem, 6.2cqh, 0.4rem);
    padding: 0 clamp(0.08rem, 1.8cqw, 0.14rem);
    box-sizing: border-box;
    border: clamp(0.01rem, 0.35cqh, 0.02rem) solid #d8c9a8;
    border-radius: 999px;
    background: #f8f1e4;
    font-size: clamp(0.11rem, 2.3cqh, 0.14rem);
    color: #4a2f22;
    text-align: center;
    outline: none;
}

.login-field input::placeholder {
    color: #a89078;
}

.login-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52%;
    min-height: clamp(0.3rem, 6.5cqh, 0.42rem);
    margin: clamp(0.04rem, 1.2cqh, 0.1rem) auto 0;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    font-family: inherit;
    transition: transform 0.2s;
}

.login-btn img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.login-btn span {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: clamp(0.13rem, 2.8cqh, 0.17rem);
    font-weight: 700;
    letter-spacing: 0.02rem;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-desc {
    flex-shrink: 1;
    min-height: 0;
    margin: clamp(0.03rem, 0.8cqh, 0.06rem) 0 0;
    padding: 0 clamp(0.04rem, 1cqw, 0.08rem);
    text-align: center;
    font-size: clamp(0.08rem, 1.8cqh, 0.11rem);
    line-height: 1.35;
    color: #8a6a52;
    overflow: hidden;
}

.login-msg {
    flex-shrink: 0;
    min-height: clamp(0.1rem, 2.4cqh, 0.16rem);
    margin-top: clamp(0.02rem, 0.6cqh, 0.05rem);
    text-align: center;
    font-size: clamp(0.09rem, 2cqh, 0.12rem);
    line-height: 1.3;
    color: #7a5a42;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-msg.error {
    color: #c0392b;
}

.login-msg.ok {
    color: #2e7d32;
}

@media (min-width: 961px) {
    .login-overlay {
        overflow: hidden;
    }

    .login-panel {
        --login-overlay-w: min(40vw, calc(var(--login-overlay-h) * 976 / 615));
        width: var(--login-overlay-w);
        max-height: min(100%, calc(var(--login-overlay-w) * 615 / 976));
    }
}

@media (max-width: 960px) {
    .login-overlay {
        padding: 0 0.06rem;
    }

    .login-panel {
        --login-overlay-w: calc(100vw - 0.12rem);
        width: min(var(--login-overlay-w), calc(var(--login-overlay-h) * 976 / 615));
        max-height: min(100%, calc(var(--login-overlay-w) * 615 / 976));
    }
}
