/* =============================================================================
 * 登录页 · 共享骨架（宋版书风细节由 themes/<key>/style.css 变量驱动）
 * =============================================================================
 * 文件：assets/css/auth.css（原 auth_song.css 改名，结构共享，颜色走主题变量）
 *
 * =============================================================================
 *  一、设计依据
 * =============================================================================
 *   宋代版刻（建本、蜀本、浙本）的美学：
 *     - 缃白宣纸底
 *     - 墨色字，浓淡分明
 *     - 朱砂印记
 *     - 界栏（细黑线分栏）
 *     - 大面积留白
 *     - 鱼尾、书耳等版式元素
 *
 * =============================================================================
 *  二、配色
 * =============================================================================
 *   缃白   var(--paper)   宣纸底
 *   纸二   var(--paper-2)   略深
 *   墨     var(--text)   正文
 *   淡墨   var(--text-2)   次级
 *   朱砂   var(--red)   印章、强调
 *   泥金   var(--gold)   金线、装饰
 *
 * =============================================================================
 *  三、保留的炫酷元素
 * =============================================================================
 *   - 太极缓慢旋转
 *   - 墨点飞散背景（Canvas）
 *   - 金色流扫按钮
 *   - 错误抖动
 * ============================================================================= */

/* ---------- 页面：宣纸底 ---------- */
.login-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;

    /* 宣纸底 + 细微纹理 */
    background-color: var(--paper);
    background-image:
        /* 纸纤维 */
        repeating-linear-gradient(92deg, transparent 0 3px, rgba(139, 120, 85, .022) 3px 4px),
        repeating-linear-gradient(2deg, transparent 0 5px, rgba(139, 120, 85, .018) 5px 6px),
        /* 中心微光 */
        radial-gradient(ellipse 90% 70% at 50% 40%, rgba(255, 253, 246, .8), transparent 72%),
        /* 四角压暗 */
        radial-gradient(ellipse at center, transparent 42%, rgba(90, 74, 48, .1) 100%);

    color: var(--text);
    font-family: var(--font-serif);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px 16px;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* 墨点飞散画布 */
.login-stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: .55;
}

/* ---------- 主容器 ---------- */
.login-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 396px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---------- 太极 + 标题 ---------- */
.login-head {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* 太极：墨色，朱砂点缀 */
.login-tai {
    width: 70px;
    height: 70px;
    color: var(--text);
    opacity: .92;
    filter: drop-shadow(0 2px 6px rgba(26, 25, 21, .16));
}

.login-tai svg {
    width: 100%;
    height: 100%;
    display: block;
    animation: tai-spin 90s linear infinite;
}

@keyframes tai-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .login-tai svg { animation: none; }
}

/* 标题：宋刻大字 */
.login-title {
    margin: 6px 0 0;
    font-family: var(--font-serif);
    font-size: 27px;
    font-weight: 700;
    letter-spacing: .42em;
    text-indent: .42em;
    color: var(--ink);
    text-shadow:
        0 1px 0 rgba(255, 255, 255, .85),
        0 2px 10px rgba(26, 25, 21, .1);
}

.login-sub {
    margin: 0;
    font-size: 11.5px;
    letter-spacing: .24em;
    text-indent: .24em;
    color: var(--text-3);
}

/* 宋版：双横线分隔 */
.login-head::after {
    content: "";
    width: 64%;
    max-width: 210px;
    height: 3px;
    margin-top: 2px;
    border-top: 1px solid rgba(34, 31, 25, .35);
    border-bottom: 1px solid rgba(34, 31, 25, .16);
}

/* ---------- 表单卡片：宋版书页 ---------- */
.login-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px 24px 24px;
    border-radius: 1px;

    /* 纸白，比背景略亮 */
    background:
        linear-gradient(178deg, var(--paper-grad-1) 0%, var(--paper-grad-2) 55%, var(--paper-grad-3) 100%);

    /* 宋版边框：外粗内细 */
    border: 1px solid rgba(34, 31, 25, .38);
    box-shadow:
        /* 内细线（界栏） */
        0 0 0 1px rgba(34, 31, 25, .1) inset,
        /* 内白高光 */
        0 1px 0 rgba(255, 255, 255, .9) inset,
        /* 外投影 */
        0 2px 4px rgba(26, 25, 21, .06),
        0 16px 40px rgba(74, 62, 40, .13);

    position: relative;
}

/* 四角鱼尾纹（宋版装饰） */
.login-card::before,
.login-card::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 3px;
    border-color: rgba(140, 35, 33, .55);
    border-style: solid;
    pointer-events: none;
}

.login-card::before {
    top: 8px;
    left: 8px;
    border-width: 1px 0 0 0;
    box-shadow: 0 0 0 0 transparent;
}

.login-card::after {
    bottom: 8px;
    right: 8px;
    border-width: 0 0 1px 0;
}

/* ---------- 字段 ---------- */
.lg-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.lg-label {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
    cursor: pointer;
}

/* 字段名：朱砂竖条 + 墨字 */
.lg-label__cn {
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .18em;
    color: var(--ink);

    padding: 0 0 0 9px;
    position: relative;
}

.lg-label__cn::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 13px;
    background: linear-gradient(180deg, var(--red), var(--red-deep));
    border-radius: 0;
    box-shadow: 0 0 0 1px rgba(140, 35, 33, .18);
}

/* 提示语：楷体，淡墨 */
.lg-label__hint {
    font-family: var(--font-kai);
    font-size: 11.5px;
    letter-spacing: .03em;
    color: var(--text-3);
    font-style: italic;
}

/* 难度标签 */
.lg-level {
    margin-left: auto;
    padding: 0 6px;
    border-radius: 1px;
    font-size: 10px;
    line-height: 1.7;
    letter-spacing: .08em;
    background: rgba(255, 255, 255, .5);
}

.lg-level--1 {
    color: var(--green);
    border: 1px solid rgba(61, 82, 52, .38);
}

.lg-level--2 {
    color: var(--gold-deep);
    border: 1px solid rgba(176, 141, 79, .55);
}

.lg-level--3 {
    color: var(--red);
    border: 1px solid rgba(140, 35, 33, .42);
}

/* ---------- 输入框：界栏格 ---------- */
.lg-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 13px;
    border-radius: 1px;
    border: 1px solid rgba(34, 31, 25, .22);

    background: rgba(255, 255, 255, .62);
    box-shadow:
        0 1px 2px rgba(74, 62, 40, .06) inset,
        0 1px 0 rgba(255, 255, 255, .8);

    color: var(--text);
    font-family: var(--font-serif);
    font-size: 15px;
    letter-spacing: .05em;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    -webkit-appearance: none;
}

.lg-input::placeholder {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: .04em;
}

.lg-input:focus {
    outline: none;
    border-color: rgba(140, 35, 33, .55);
    background: var(--paper-bright);
    box-shadow:
        0 0 0 3px rgba(140, 35, 33, .08),
        0 1px 3px rgba(74, 62, 40, .1) inset,
        0 0 14px rgba(176, 141, 79, .16);
}

/* 密码框 */
.lg-pwd {
    position: relative;
}

.lg-pwd .lg-input {
    padding-right: 44px;
}

.lg-eye {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    border-radius: 1px;
    transition: color .16s ease, background .16s ease;
}

.lg-eye:hover,
.lg-eye.is-on {
    color: var(--red);
    background: rgba(140, 35, 33, .07);
}

/* ---------- 卜卦区：朱印信笺 ---------- */
.lg-gua {
    display: flex;
    align-items: stretch;
    gap: 9px;
    padding: 12px 13px;
    border-radius: 1px;

    background:
        linear-gradient(135deg, rgba(140, 35, 33, .055), rgba(255, 255, 255, .4));
    border: 1px solid rgba(140, 35, 33, .26);
    border-left: 3px solid rgba(140, 35, 33, .7);
    box-shadow: 0 1px 3px rgba(74, 62, 40, .06);

    position: relative;
}

.lg-gua__q {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 9px;
}

/* 题面：墨色大字 */
.lg-gua__mark {
    font-family: var(--font-serif);
    font-size: 23px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
    letter-spacing: .08em;
}

.lg-gua__ask {
    font-family: var(--font-kai);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-2);
}

/* 换一卦：小朱印 */
.lg-refresh {
    flex: 0 0 auto;
    align-self: center;
    padding: 4px 10px;
    border-radius: 1px;
    border: 1px solid rgba(140, 35, 33, .45);
    background: rgba(255, 255, 255, .6);
    color: var(--red);
    font-family: var(--font-serif);
    font-size: 11.5px;
    letter-spacing: .08em;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s ease, color .16s ease, transform .1s ease, box-shadow .16s ease;
}

.lg-refresh:hover {
    background: var(--red);
    color: var(--paper-warm-2);
    box-shadow: 0 2px 8px rgba(140, 35, 33, .3);
}

.lg-refresh:active {
    transform: scale(.96);
}

.lg-refresh:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* 提示：楷体淡墨 */
.lg-tip {
    margin: 0;
    display: flex;
    gap: 7px;
    font-family: var(--font-kai);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--text-3);
}

.lg-tip__k {
    flex: 0 0 auto;
    font-family: var(--font-serif);
    color: var(--red);
    letter-spacing: .08em;
    opacity: .85;
}

/* ---------- 错误：朱批 ---------- */
.lg-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 1px;

    background: rgba(140, 35, 33, .07);
    border: 1px solid rgba(140, 35, 33, .32);
    border-left: 3px solid var(--red);
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--red-wine);
    animation: err-shake .42s ease;
}

/* 凶字朱印 */
.lg-error__mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border-radius: 1px;
    background: var(--red);
    color: var(--paper-warm-2);
    font-family: var(--font-serif);
    font-size: 11px;
    font-weight: 700;
    margin-top: 1px;
    box-shadow: 0 1px 3px rgba(107, 26, 24, .35);
}

@keyframes err-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-5px); }
    40%      { transform: translateX(5px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
    .lg-error { animation: none; }
}

/* ---------- 提交按钮：宋式印章 ---------- */
.lg-submit {
    position: relative;
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--red-deep);
    border-radius: 2px;

    background: linear-gradient(178deg, var(--red-strong) 0%, var(--red) 42%, var(--red-darker) 100%);
    color: var(--paper-warm);
    font-family: var(--font-serif);
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: .46em;
    text-indent: .46em;
    cursor: pointer;
    overflow: hidden;
    transition: filter .18s ease, transform .1s ease, box-shadow .18s ease;

    box-shadow:
        /* 内金线 */
        0 0 0 1px rgba(212, 184, 120, .28) inset,
        /* 立体阴影 */
        0 2px 0 rgba(107, 26, 24, .7),
        0 6px 18px rgba(107, 26, 24, .28);

    text-shadow: 0 1px 2px rgba(74, 13, 13, .5);
}

/* 金光流扫 */
.lg-submit::before {
    content: "";
    position: absolute;
    top: 0;
    left: -140%;
    width: 55%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 236, 180, .42), transparent);
    animation: btn-shine 4s ease-in-out infinite;
}

@keyframes btn-shine {
    0%, 60%   { left: -140%; }
    85%, 100% { left: 165%; }
}

@media (prefers-reduced-motion: reduce) {
    .lg-submit::before { animation: none; display: none; }
}

.lg-submit:hover {
    filter: brightness(1.1);
    box-shadow:
        0 0 0 1px rgba(212, 184, 120, .38) inset,
        0 2px 0 rgba(107, 26, 24, .7),
        0 8px 26px rgba(107, 26, 24, .38);
}

.lg-submit:active {
    transform: translateY(2px);
    box-shadow:
        0 0 0 1px rgba(212, 184, 120, .3) inset,
        0 0 0 rgba(107, 26, 24, .7),
        0 3px 10px rgba(107, 26, 24, .3);
}

.lg-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
    filter: grayscale(.3);
}

/* ---------- 底部 ---------- */
.lg-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-soft);
    letter-spacing: .08em;
}

.lg-foot a {
    color: var(--red);
    text-decoration: none;
    border-bottom: 1px solid rgba(140, 35, 33, .3);
    transition: color .16s ease, border-color .16s ease;
}

.lg-foot a:hover {
    color: var(--red-deep);
    border-bottom-color: rgba(140, 35, 33, .7);
}

.lg-dot {
    opacity: .45;
}

/* ---------- 落款：朱印 ---------- */
.login-sign {
    margin: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-kai);
    font-size: 12px;
    letter-spacing: .26em;
    color: var(--text-soft);
}

/* 印章：朱底白字 */
.login-sign::before {
    content: "玄";
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border-radius: 1px;
    background: linear-gradient(178deg, var(--red-strong), var(--red-wine));
    color: var(--paper-warm);
    font-family: var(--font-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow:
        0 1px 2px rgba(107, 26, 24, .35),
        0 0 0 1px rgba(107, 26, 24, .2);
    opacity: .9;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 380px) {
    .login-body {
        padding: 18px 12px;
    }

    .login-tai {
        width: 58px;
        height: 58px;
    }

    .login-title {
        font-size: 22px;
        letter-spacing: .32em;
        text-indent: .32em;
    }

    .login-card {
        padding: 22px 17px 20px;
        gap: 16px;
    }

    .lg-input {
        font-size: 14px;
        padding: 11px 12px;
    }

    .lg-gua__mark {
        font-size: 19px;
    }

    .lg-submit {
        font-size: 14.5px;
        letter-spacing: .36em;
        text-indent: .36em;
        padding: 13px 18px;
    }
}
