:root {
    color-scheme: light;
    --bg: #f1ebdd;
    --surface: #fbf7ec;
    --surface-soft: #f3ecdc;
    --surface-indigo: #eee5cd;
    --text: #1a110b;
    --muted: #6f6253;
    --subtle: #948675;
    --line: #ded3bd;
    --line-strong: #c9b999;
    --primary: #8b6508;
    --primary-hover: #694b06;
    --violet: #75521c;
    --primary-soft: #eee2bd;
    --success: #397052;
    --success-soft: #e4f0e7;
    --warning: #956117;
    --warning-soft: #f8edd5;
    --danger: #b3342a;
    --danger-soft: #f9e5e1;
    --overlay: rgba(26, 17, 11, .52);
    --focus-ring: rgba(184, 134, 11, .28);
    --shadow-sm: 0 1px 3px rgba(61, 43, 21, .08), 0 1px 2px rgba(61, 43, 21, .05);
    --shadow-lg: 0 24px 64px rgba(26, 17, 11, .2);
    /* 周风雅韵 · 登录页配色 */
    --zs-paper: #F5F0E1;
    --zs-card: #FBF7EC;
    --zs-ink: #1A110B;
    --zs-ink-soft: rgba(26, 17, 11, .72);
    --zs-xun: #B8860B;
    --zs-xun-deep: #8B6508;
    --zs-seal: #B3342A;
    --zs-serif: "Noto Serif SC", "Source Han Serif SC", "思源宋体", "STZhongsong", "STSong", "SimSun", serif;
}

html[data-theme="xuan_mo"] {
    color-scheme: dark;
    --bg: #0f100e;
    --surface: #1a1b17;
    --surface-soft: #24251f;
    --surface-indigo: #2d2a20;
    --text: #eee7d7;
    --muted: #b9ae9b;
    --subtle: #857b6b;
    --line: #3a382f;
    --line-strong: #565143;
    --primary: #d1a84c;
    --primary-hover: #e4bf66;
    --violet: #c49a55;
    --primary-soft: #352d1c;
    --success: #79bd92;
    --success-soft: #183326;
    --warning: #e0ad55;
    --warning-soft: #3a2b16;
    --danger: #ef8279;
    --danger-soft: #3a1f1d;
    --overlay: rgba(0, 0, 0, .72);
    --focus-ring: rgba(209, 168, 76, .35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .32);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .52);
    --zs-paper: #12130f;
    --zs-card: #1c1d18;
    --zs-ink: #eee7d7;
    --zs-ink-soft: rgba(238, 231, 215, .72);
    --zs-xun: #d1a84c;
    --zs-xun-deep: #e0bd6b;
    --zs-seal: #e16d61;
}

* { box-sizing: border-box; }
.startup-view { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 14px; z-index: 100; }
html, body { height: 100%; }
html { overflow: hidden; background: var(--bg); }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--user-font-family, Inter), -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 1rem; line-height: 1.55; text-rendering: optimizeLegibility; }
.reading-frame { width: 100%; height: min(68vh, 720px); border: 1px solid var(--line); background: #f7f7f7; }
.reading-toolbar { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
#chatRoomList, #chatRoomMessages { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
#chatRoomMessages { max-height: 40vh; overflow: auto; padding: 10px; border: 1px solid var(--line); }
#chatRoomMessages p { margin: 0; padding: 6px 8px; background: var(--surface-soft); border-radius: 6px; }
.language-toggle { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.75rem; font-weight: 700; }
.auth-language-toggle { position: fixed; z-index: 80; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); min-width: 74px; height: 36px; padding: 0 11px; border-radius: 8px; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-word { font-weight: 760; font-size: 1.1875rem; letter-spacing: -.03em; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: #3730a3; color: #fff; font-weight: 780; font-size: 1.3125rem; letter-spacing: -.04em; box-shadow: 0 10px 24px rgba(55, 48, 163, .22); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 1rem; box-shadow: none; }
.brand-mark.tiny { width: 30px; height: 30px; border-radius: 9px; font-size: 0.8125rem; box-shadow: none; }
.brand-mark.large { width: 58px; height: 58px; border-radius: 18px; font-size: 1.4375rem; box-shadow: none; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.branding-preview { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); margin-top: 12px; }
.eyebrow { color: var(--primary); font-size: 0.75rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }

/* —— 登录页 · 周风雅韵（左：品牌文化长卷 / 右：极简登录卡） —— */
.auth-view { height: 100dvh; display: grid; grid-template-columns: minmax(500px, 1.15fr) minmax(420px, .85fr); overflow: hidden; background: var(--zs-paper); }
.auth-intro { position: relative; overflow-y: auto; overscroll-behavior: contain; padding: clamp(72px, 9vh, 96px) clamp(34px, 5.5vw, 92px) 34px; color: var(--zs-ink); background: var(--zs-paper); border-right: 1px solid rgba(26, 17, 11, .16); }
.auth-intro::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .03; background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%231A110B' stroke-width='3'%3E%3Cpath d='M24 64h36V36H40v16h40'/%3E%3Cpath d='M136 96h-36v28h20v-16h-40'/%3E%3Cpath d='M96 24v36h28V40h-16v40'/%3E%3Cpath d='M64 136v-36H36v20h16v-40'/%3E%3C/g%3E%3C/svg%3E") repeat; background-size: 160px; }
.auth-intro > * { position: relative; z-index: 1; }
.zs-brand { margin: 0 0 clamp(26px, 4.5vh, 52px); }
.zs-logo { margin: 0; font-family: var(--zs-serif); font-size: clamp(56px, 5.4vw, 76px); font-weight: 900; line-height: 1.12; letter-spacing: .08em; color: var(--zs-ink); }
.zs-logo em { font-style: normal; color: var(--zs-xun-deep); }
.zs-brand-sub { margin: 14px 0 0; font-family: var(--zs-serif); font-size: 18px; letter-spacing: .3em; color: var(--zs-ink-soft); }
.zs-brand-sub em { font-style: normal; font-weight: 800; color: var(--zs-xun-deep); }
.zs-slogan { margin: 0 0 22px; text-align: center; }
.zs-slogan-main { margin: 0; font-family: var(--zs-serif); font-size: clamp(46px, 4.4vw, 60px); font-weight: 800; line-height: 1.3; color: var(--zs-ink); }
.zs-slogan-main strong { font-size: 1.05em; font-weight: 900; letter-spacing: .05em; }
.zs-slogan-main .zs-dot { margin: 0 .16em; color: var(--zs-xun); }
.zs-slogan-sub { margin: 10px 0 0; font-family: var(--zs-serif); font-size: clamp(1rem, 1.5vw, 1.1875rem); letter-spacing: .2em; color: var(--zs-xun-deep); }
.zs-lead { max-width: 720px; margin: 0 auto clamp(28px, 4.5vh, 50px); font-family: var(--zs-serif); font-size: clamp(1.1875rem, 1.6vw, 1.375rem); line-height: 1.8; text-align: center; color: var(--zs-ink-soft); }
.zs-culture { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: clamp(24px, 4vh, 42px); }
.zs-card { position: relative; overflow: hidden; padding: 20px 18px; border: 1px solid rgba(184, 134, 11, .42); border-radius: 4px; background: var(--zs-card); box-shadow: 0 2px 12px rgba(26, 17, 11, .06); }
.zs-card::before { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(184, 134, 11, .18); pointer-events: none; }
.zs-card::after { content: "凤"; position: absolute; right: -12px; bottom: -22px; font-family: var(--zs-serif); font-size: 5.5rem; font-weight: 900; color: rgba(184, 134, 11, .08); pointer-events: none; }
.zs-card h2 { margin: 0 0 12px; font-family: var(--zs-serif); font-size: clamp(1.25rem, 1.6vw, 1.5rem); letter-spacing: .06em; color: var(--zs-ink); }
.zs-card h2 span { color: var(--zs-xun-deep); }
.zs-card p { margin: 0; font-size: clamp(0.96875rem, 1.2vw, 1.09375rem); line-height: 1.85; text-align: justify; color: rgba(26, 17, 11, .8); }
.zs-hl { font-style: normal; font-weight: 800; color: var(--zs-xun-deep); }
.zs-note { font-weight: 700; color: var(--zs-xun-deep); }
.zs-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: clamp(28px, 4.5vh, 52px); }
.zs-points > div { padding: 15px 16px; border: 1px solid rgba(26, 17, 11, .18); border-radius: 4px; background: rgba(255, 253, 247, .6); }
.zs-points > div > span { margin-right: 7px; color: var(--zs-xun-deep); font-size: 1.125rem; font-weight: 800; }
.zs-points strong { font-family: var(--zs-serif); font-size: 1.0625rem; letter-spacing: .1em; color: var(--zs-ink); }
.zs-points small { display: block; margin-top: 6px; font-size: 0.9375rem; line-height: 1.8; color: rgba(26, 17, 11, .66); }
.zs-quote { position: relative; padding: 22px 0 78px; border-top: 1px solid rgba(26, 17, 11, .2); text-align: center; font-family: var(--zs-serif); }
.zs-quote p { margin: 0; font-size: 1rem; letter-spacing: .12em; color: rgba(26, 17, 11, .85); }
.zs-quote .zs-quote-src { margin-top: 8px; font-size: 0.8125rem; letter-spacing: .2em; color: rgba(26, 17, 11, .55); }
/* 「文母」压角章：钤于落款右下方，错落如书画 */
.zs-seal { position: absolute; right: clamp(18px, 11%, 130px); bottom: 30px; width: 60px; height: 60px; display: inline-grid; place-items: center; transform: rotate(4deg); border-radius: 7px; background: var(--zs-seal); color: #F7EFDF; font-family: var(--zs-serif); font-size: 1.1875rem; font-weight: 700; line-height: 1.15; writing-mode: vertical-rl; letter-spacing: .12em; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .34), 0 3px 10px rgba(179, 52, 42, .32); }
.zs-copyright { position: absolute; bottom: 10px; left: 0; right: 0; margin: 0; text-align: center; font-size: 0.6875rem; letter-spacing: .22em; color: rgba(26, 17, 11, .38); font-family: var(--zs-serif); }
.auth-side { display: grid; place-items: center; overflow-y: auto; padding: clamp(24px, 4vh, 52px) clamp(22px, 3vw, 48px); background: linear-gradient(180deg, #F9F5EA 0%, var(--zs-paper) 100%); }
.auth-card { position: relative; width: clamp(340px, 30vw, 500px); max-width: 100%; padding: clamp(26px, 2.6vw, 38px) clamp(24px, 2.4vw, 34px) 24px; border: 1px solid rgba(26, 17, 11, .62); border-radius: 10px; background: #FFFDF7; box-shadow: 0 24px 64px rgba(26, 17, 11, .16); }
.auth-card::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(26, 17, 11, .15); border-radius: 6px; pointer-events: none; }
.auth-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--zs-xun), var(--zs-xun)) left 0 top 0 / 18px 2px, linear-gradient(var(--zs-xun), var(--zs-xun)) left 0 top 0 / 2px 18px, linear-gradient(var(--zs-xun), var(--zs-xun)) right 0 top 0 / 18px 2px, linear-gradient(var(--zs-xun), var(--zs-xun)) right 0 top 0 / 2px 18px, linear-gradient(var(--zs-xun), var(--zs-xun)) left 0 bottom 0 / 18px 2px, linear-gradient(var(--zs-xun), var(--zs-xun)) left 0 bottom 0 / 2px 18px, linear-gradient(var(--zs-xun), var(--zs-xun)) right 0 bottom 0 / 18px 2px, linear-gradient(var(--zs-xun), var(--zs-xun)) right 0 bottom 0 / 2px 18px; background-repeat: no-repeat; }
.auth-card > * { position: relative; }
/* 登录卡头像位：默认「17」，站点头像同步展示；点击可查看大图 */
.auth-avatar { width: 92px; height: 92px; margin: 0 auto 18px; display: grid; place-items: center; padding: 0; overflow: hidden; border: 2px solid var(--zs-xun); border-radius: 50%; outline: 1px solid rgba(184, 134, 11, .35); outline-offset: 4px; background: var(--zs-card); color: var(--zs-xun-deep); font-family: var(--zs-serif); font-size: 2.375rem; font-weight: 900; letter-spacing: .02em; cursor: pointer; box-shadow: 0 4px 14px rgba(26, 17, 11, .12); transition: transform .25s ease, box-shadow .25s ease; }
.auth-avatar:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(26, 17, 11, .18); }
.auth-avatar:focus-visible { outline: 2px solid var(--zs-xun); outline-offset: 5px; }
.auth-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.auth-card-heading { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 22px; }
.auth-card-heading strong { font-family: var(--zs-serif); font-size: clamp(1.1875rem, 1.5vw, 1.4375rem); letter-spacing: .05em; color: var(--zs-ink); }
.auth-card-heading span { margin-top: 5px; font-family: var(--zs-serif); font-size: clamp(0.75rem, 1vw, 0.875rem); letter-spacing: .26em; color: var(--zs-xun-deep); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 24px; border: 1px solid rgba(26, 17, 11, .14); border-radius: 11px; background: #F4EEDD; }
.auth-tab { min-height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--zs-ink-soft); cursor: pointer; font-family: var(--zs-serif); letter-spacing: .14em; }
.auth-tab.active { background: #FFFDF7; color: var(--zs-ink); font-weight: 700; box-shadow: 0 1px 4px rgba(26, 17, 11, .14); }
.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field > span { color: #344054; font-size: 0.8125rem; font-weight: 650; }
.field input, .field select { width: 100%; min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.field input:hover, .field select:hover { border-color: #aeb4c0; }
.field input:focus, .field select:focus { border-color: var(--primary); }
.password-control { position: relative; display: block; width: 100%; min-width: 0; }
.field > .password-control { color: inherit; font-size: inherit; font-weight: inherit; }
.password-control input { padding-right: 48px; }
.password-control input::-ms-reveal, .password-control input::-ms-clear { display: none; }
.password-visibility-toggle { position: absolute; z-index: 1; top: 50%; right: 4px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; transform: translateY(-50%); border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.password-visibility-toggle:hover, .password-visibility-toggle:focus-visible { background: var(--surface-soft); color: var(--text); }
.password-visibility-toggle svg { width: 18px; height: 18px; pointer-events: none; }
.form-error { min-height: 23px; margin: -2px 0 9px; color: var(--danger); font-size: 0.8125rem; }
.primary-button { min-height: 44px; padding: 0 17px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; cursor: pointer; font-weight: 680; }
.primary-button:hover:not(:disabled) { background: var(--primary-hover); }
.auth-submit { width: 100%; height: 48px; border-radius: 8px; background: var(--zs-ink); color: var(--zs-xun); font-family: var(--zs-serif); font-size: 0.9375rem; font-weight: 700; letter-spacing: .3em; text-indent: .3em; }
.auth-submit:hover:not(:disabled) { background: #2E2216; color: #C9962E; }
/* 密码框下 · 忘记密码 */
.auth-form-foot { display: flex; justify-content: flex-end; margin: -8px 0 14px; }
.auth-mini-link { border: 0; background: transparent; padding: 0; cursor: pointer; font-family: var(--zs-serif); font-size: 0.78125rem; letter-spacing: .06em; color: var(--zs-xun-deep); }
.auth-mini-link:hover { text-decoration: underline; }
/* 登录按钮下 · 立即注册引导 */
.auth-register-prompt { margin: 14px 0 0; text-align: center; font-size: 0.8125rem; color: rgba(26, 17, 11, .6); }
.auth-register-link { border: 0; background: transparent; padding: 0; cursor: pointer; font-family: var(--zs-serif); font-size: 0.8125rem; font-weight: 700; letter-spacing: .06em; color: var(--zs-xun-deep); }
.auth-register-link:hover { text-decoration: underline; color: var(--zs-xun); }
/* 用户协议 · 文言 + 打钩（选中朱红） */
.auth-agreement { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid rgba(26, 17, 11, .1); font-size: 0.78125rem; line-height: 1.7; color: rgba(26, 17, 11, .68); cursor: pointer; }
.auth-agreement input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--zs-seal); cursor: pointer; flex: 0 0 auto; }
.auth-agreement a { color: var(--zs-xun-deep); text-decoration: underline; text-underline-offset: 3px; }
.auth-agreement a:hover { color: var(--zs-xun); }
/* 协议弹窗（文言示例）：加宽放大 + flex 布局，长文在 body 区域滚动，按钮常驻可见 */
.agreement-dialog { display: flex; flex-direction: column; width: min(600px, calc(100vw - 40px)); max-height: min(82dvh, 760px); padding: 28px 30px 24px; border: 1px solid rgba(26, 17, 11, .55); border-radius: 12px; background: #FFFDF7; color: var(--zs-ink); font-family: var(--zs-serif); box-shadow: 0 24px 64px rgba(26, 17, 11, .22); }
.agreement-dialog::backdrop { background: rgba(26, 17, 11, .45); }
.agreement-dialog h3 { margin: 0 0 14px; font-size: 1.25rem; letter-spacing: .18em; text-align: center; }
.agreement-dialog-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; font-size: 1rem; line-height: 1.95; white-space: pre-line; color: rgba(26, 17, 11, .82); }
.agreement-dialog-note { margin: 14px 0 0; font-size: 0.78125rem; color: rgba(26, 17, 11, .45); text-align: right; }
.agreement-close { flex: 0 0 auto; display: block; margin: 18px auto 0; min-width: 120px; height: 40px; border: 0; border-radius: 8px; background: var(--zs-ink); color: var(--zs-xun); cursor: pointer; font-family: var(--zs-serif); font-size: 0.90625rem; font-weight: 700; letter-spacing: .2em; text-indent: .2em; }
.agreement-close:hover { background: #2E2216; color: #C9962E; }
.avatar-preview-dialog { width: min(560px, calc(100vw - 32px)); min-height: 0; padding: 24px; border: 1px solid rgba(26, 17, 11, .55); border-radius: 12px; background: #FFFDF7; box-shadow: 0 24px 64px rgba(26, 17, 11, .25); }
.avatar-preview-dialog::backdrop { background: rgba(26, 17, 11, .52); }
.avatar-preview-close { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--zs-ink-soft); cursor: pointer; font-size: 1.5rem; line-height: 1; }
.avatar-preview-close:hover, .avatar-preview-close:focus-visible { background: #F4EEDD; color: var(--zs-ink); }
.avatar-preview-content { display: grid; place-items: center; min-height: 260px; }
.avatar-preview-image, .avatar-preview-fallback { width: min(420px, 75vw); aspect-ratio: 1; border-radius: 12px; object-fit: contain; }
.avatar-preview-fallback { display: grid; place-items: center; border: 2px solid var(--zs-xun); outline: 1px solid rgba(184, 134, 11, .35); outline-offset: 5px; background: var(--zs-card); color: var(--zs-xun-deep); font-family: var(--zs-serif); font-size: 8.75rem; font-weight: 900; }
.auth-quote { margin: 16px 0 0; padding-top: 13px; border-top: 1px dashed rgba(26, 17, 11, .22); font-family: var(--zs-serif); font-size: 0.75rem; line-height: 1.9; letter-spacing: .06em; text-align: center; color: rgba(26, 17, 11, .62); }
.auth-link { width: 100%; margin-top: 12px; border: 0; background: transparent; color: var(--zs-xun-deep); cursor: pointer; font-size: 0.75rem; }
.auth-link:hover { text-decoration: underline; }
.auth-card .field > span { color: var(--zs-ink-soft); }
.auth-card .field input { border-color: rgba(26, 17, 11, .28); height: 50px; }
.auth-card .field input:hover { border-color: rgba(184, 134, 11, .6); }
.auth-card .field input:focus { border-color: var(--zs-xun); box-shadow: 0 0 0 3px rgba(184, 134, 11, .18); outline: 0; }
.auth-card .password-visibility-toggle:hover, .auth-card .password-visibility-toggle:focus-visible { background: #F4EEDD; }


/* Shared station avatar: use the same crop as the login avatar. */
.brand-mark[data-site-brand-avatar] { border-radius: 50%; overflow: hidden; background: var(--zs-card); color: var(--zs-xun-deep); border: 1px solid var(--zs-xun); font-family: var(--zs-serif); }
