@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;600;700;900&family=ZCOOL+XiaoWei&display=swap");

:root {
  --ink: #171326;
  --paper: #f7efe4;
  --gold: #d4a355;
  --gold-light: #f3d493;
  --wine: #7c2e42;
  --muted: #766b71;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: #171326; font-family: "Noto Serif SC", "Songti SC", serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.auth-page { position: relative; min-height: calc(100svh - 92px); display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(430px, .85fr); overflow: hidden; background: #211831; }
.auth-page::before { content: ""; position: absolute; inset: 0 38% 0 0; background: linear-gradient(90deg, rgba(19,13,34,.76), rgba(23,15,40,.24)), linear-gradient(0deg, rgba(22,14,36,.64), transparent 55%), url("../image/image_xfy_bg2.jpg") center 45% / cover no-repeat; }
.auth-page::after { content: ""; position: absolute; z-index: 1; left: 0; right: 38%; bottom: -80px; height: 190px; border-radius: 50%; background: rgba(240,226,231,.24); filter: blur(42px); }
.auth-brand { position: absolute; z-index: 10; top: 34px; left: clamp(28px, 4vw, 70px); display: flex; align-items: center; gap: 12px; color: white; }
.brand-seal { display: grid; place-items: center; width: 42px; height: 42px; color: #392434; background: linear-gradient(145deg, #ffe1a0, #c99145); border: 1px solid rgba(255,255,255,.55); border-radius: 12px 4px 12px 4px; font-family: "ZCOOL XiaoWei", serif; font-size: 23px; box-shadow: 0 5px 18px rgba(0,0,0,.22); }
.auth-brand strong { display: block; font-size: 20px; letter-spacing: .16em; }
.auth-brand small { display: block; margin-top: 3px; color: rgba(255,255,255,.57); font: 8px/1 Arial, sans-serif; letter-spacing: .27em; }
.back-home { position: absolute; z-index: 10; top: 42px; right: clamp(28px, 4vw, 65px); color: #77666a; font-size: 13px; letter-spacing: .12em; transition: color .2s ease; }
.back-home span { margin-right: 8px; }
.back-home:hover { color: var(--wine); }

.auth-story { position: relative; z-index: 2; min-height: 760px; padding: 130px clamp(32px, 5vw, 86px) 70px; display: flex; align-items: center; color: white; overflow: hidden; }
.auth-story::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,13,34,.45), transparent 70%); }
.auth-story > img { position: absolute; z-index: 1; right: clamp(-300px, -19vw, -120px); bottom: -7%; width: min(70vw, 920px); max-height: 91%; object-fit: contain; object-position: bottom right; filter: drop-shadow(-22px 20px 28px rgba(17,8,28,.32)); animation: character-in 1s .15s ease-out both; }
.story-copy { position: relative; z-index: 3; align-self: center; transform: translateY(-24px); animation: story-in .8s ease-out both; }
.eyebrow { margin: 0 0 18px; color: var(--gold-light); font: 10px/1.3 Arial, sans-serif; letter-spacing: .34em; }
.story-copy h1 { margin: 0; font-family: "ZCOOL XiaoWei", "STKaiti", serif; font-size: clamp(54px, 5vw, 82px); line-height: 1.2; font-weight: 400; letter-spacing: .1em; text-shadow: 0 10px 34px rgba(12,7,25,.48); }
.story-copy h1 span { color: var(--gold-light); }
.story-copy > p:not(.eyebrow) { margin: 20px 0 30px; color: rgba(255,255,255,.67); font-size: 14px; letter-spacing: .1em; }
.realm-status { display: inline-flex; align-items: center; gap: 10px; padding: 10px 15px; color: rgba(255,255,255,.76); background: rgba(20,13,36,.43); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(8px); font-size: 12px; letter-spacing: .1em; }
.realm-status i { width: 7px; height: 7px; border-radius: 50%; background: #70d69c; box-shadow: 0 0 9px #70d69c; }
.realm-status em { color: #83dba8; font-style: normal; }

.auth-panel { position: relative; z-index: 5; width: 100%; min-height: 760px; padding: 104px clamp(42px, 5vw, 86px) 60px; background: radial-gradient(circle at 90% 5%, rgba(215,170,97,.14), transparent 24%), var(--paper); box-shadow: -30px 0 60px rgba(19,11,31,.16); }
.auth-panel::before { content: ""; position: absolute; inset: 18px; border: 1px solid rgba(135,91,65,.18); pointer-events: none; }
.panel-ornament { position: absolute; top: 29px; left: 50%; color: #b57c4d; font-size: 10px; transform: translateX(-50%); }
.panel-ornament::before, .panel-ornament::after { content: ""; display: inline-block; vertical-align: middle; width: 30px; height: 1px; margin: 0 10px; background: currentColor; opacity: .55; }
.panel-header { position: relative; text-align: center; margin-bottom: 30px; }
.panel-header p { margin: 0 0 10px; color: #a97651; font: 9px/1 Arial, sans-serif; letter-spacing: .4em; }
.panel-header h2 { margin: 0 0 9px; font-family: "ZCOOL XiaoWei", "STKaiti", serif; font-size: 38px; font-weight: 400; letter-spacing: .18em; }
.panel-header > span { color: #8a7c7d; font-size: 12px; letter-spacing: .08em; }

.switch-buttons { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 27px; border-bottom: 1px solid rgba(105,73,63,.2); }
.switch-buttons button { position: relative; padding: 13px; color: #9a8b89; background: none; border: 0; cursor: pointer; font-size: 15px; letter-spacing: .25em; transition: color .2s ease; }
.switch-buttons button::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 0; height: 2px; background: var(--wine); transition: .25s ease; }
.switch-buttons button.active { color: var(--wine); font-weight: 700; }
.switch-buttons button.active::after { left: 15%; width: 70%; }
.form-hidden { display: none; }
.form-visible { display: block; animation: form-in .3s ease both; }
.lowin-group { margin-bottom: 18px; text-align: left; }
.lowin-group label { display: block; margin: 0 0 8px; color: #5e5054; font-size: 12px; font-weight: 600; letter-spacing: .1em; }
.input-wrap { display: grid; grid-template-columns: 48px 1fr; align-items: center; height: 51px; background: rgba(255,253,248,.76); border: 1px solid rgba(102,74,68,.18); transition: border-color .2s ease, box-shadow .2s ease; }
.input-wrap:focus-within { border-color: rgba(156,49,69,.6); box-shadow: 0 0 0 3px rgba(156,49,69,.07); }
.input-wrap > span { display: grid; place-items: center; height: 25px; color: #aa774d; border-right: 1px solid rgba(102,74,68,.16); font-family: "ZCOOL XiaoWei", serif; }
.lowin-input { width: 100%; height: 50px; padding: 0 15px; color: #332a31; background: transparent; border: 0; outline: 0; font-size: 14px; }
.lowin-input::placeholder { color: #b3a6a4; }
.modal-content > .lowin-group .lowin-input { background: rgba(255,253,248,.86); border: 1px solid rgba(102,74,68,.2); }
.agreement-label { position: relative; display: flex; align-items: flex-start; gap: 9px; margin: 6px 0 22px; color: #8a7d7c; font-size: 11px; line-height: 1.7; cursor: pointer; }
.agreement-label input { position: absolute; opacity: 0; }
.checkmark { flex: 0 0 15px; width: 15px; height: 15px; margin-top: 2px; border: 1px solid #b49c8f; background: rgba(255,255,255,.5); }
.agreement-label input:checked + .checkmark { border-color: var(--wine); background: var(--wine); box-shadow: inset 0 0 0 3px var(--paper); }
.agreement-label a { color: var(--wine); }
.lowin-btn { display: flex; align-items: center; justify-content: center; gap: 26px; width: 100%; min-height: 51px; padding: 13px 22px; color: #322033; background: linear-gradient(135deg, #f3d89b, #cc9547); border: 1px solid rgba(106,67,45,.2); box-shadow: 0 10px 24px rgba(95,61,47,.18), inset 0 0 0 3px rgba(255,255,255,.18); cursor: pointer; font-weight: 700; letter-spacing: .24em; transition: transform .22s ease, box-shadow .22s ease, filter .22s ease; }
.lowin-btn:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 14px 28px rgba(95,61,47,.24), inset 0 0 0 3px rgba(255,255,255,.18); }
.lowin-btn i { font: normal 20px/1 sans-serif; }
.panel-help { margin: 20px 0 0; color: #aa9c99; text-align: center; font-size: 11px; letter-spacing: .06em; }

#qrcode { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; overflow: hidden; }
.modal { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(12,8,21,.72); backdrop-filter: blur(10px); }
.modal-content { position: relative; width: min(440px, 100%); padding: 38px; background: var(--paper); border: 1px solid rgba(238,202,139,.5); box-shadow: 0 28px 80px rgba(5,3,10,.48); }
.modal-content::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(135,91,65,.18); pointer-events: none; }
.modal-heading { position: relative; margin-bottom: 25px; text-align: center; }
.modal-heading span, .agreement-header span { color: #a97651; font: 8px/1 Arial, sans-serif; letter-spacing: .35em; }
.modal-heading h3, .agreement-header h3 { margin: 8px 0; font-family: "ZCOOL XiaoWei", serif; font-size: 29px; font-weight: 400; letter-spacing: .14em; }
.modal-heading p { margin: 0; color: #8b7d7b; font-size: 12px; }
.agreement-content { width: min(620px, 100%); max-height: min(80vh, 700px); padding: 0; overflow: hidden; }
.agreement-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 26px 30px 18px; background: var(--paper); border-bottom: 1px solid rgba(105,73,63,.16); }
.agreement-header h3 { margin-bottom: 0; }
.close-btn { width: 38px; height: 38px; padding: 0; color: #8b7976; background: transparent; border: 1px solid rgba(105,73,63,.2); cursor: pointer; font-size: 24px; line-height: 1; }
.agreement-body { position: relative; max-height: 48vh; padding: 12px 32px 24px; overflow-y: auto; color: #706166; font-size: 13px; line-height: 1.85; }
.agreement-body h4 { margin: 20px 0 5px; color: #4e3d44; font-size: 15px; }
.agreement-body p { margin: 0; }
.modal-footer { position: relative; padding: 0 30px 30px; }

.auth-footer { min-height: 92px; padding: 20px 5vw; color: rgba(255,255,255,.35); background: #100d1a; text-align: center; font-size: 10px; line-height: 1.8; letter-spacing: .03em; }
.auth-footer p { margin: 3px 0; }

@keyframes story-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(-24px); } }
@keyframes character-in { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes form-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; padding-top: 250px; background: #211831; }
  .auth-page::before { inset: 0 0 auto; height: 330px; background-position: center 42%; }
  .auth-page::after { right: 0; bottom: auto; top: 230px; height: 90px; }
  .auth-story { position: absolute; inset: 0 0 auto; min-height: 330px; height: 330px; padding: 95px 35px 30px; }
  .auth-story > img { right: -75px; bottom: -120px; width: 430px; height: 420px; opacity: .88; }
  .story-copy { transform: none; }
  .story-copy h1 { font-size: 43px; }
  .story-copy > p:not(.eyebrow), .realm-status { display: none; }
  .auth-panel { min-height: auto; padding: 86px max(44px, 12vw) 65px; }
  .back-home { color: rgba(255,255,255,.7); }
}

@media (max-width: 560px) {
  .auth-page { padding-top: 220px; }
  .auth-page::before, .auth-story { height: 280px; }
  .auth-brand { top: 22px; left: 20px; }
  .auth-brand strong { font-size: 17px; }
  .auth-brand small { display: none; }
  .brand-seal { width: 35px; height: 35px; font-size: 19px; }
  .back-home { top: 29px; right: 20px; font-size: 11px; }
  .auth-story { padding: 88px 22px 20px; }
  .auth-story > img { right: -128px; bottom: -124px; width: 420px; }
  .story-copy h1 { font-size: 36px; }
  .eyebrow { font-size: 7px; }
  .auth-panel { padding: 75px 30px 52px; }
  .auth-panel::before { inset: 10px; }
  .panel-header h2 { font-size: 32px; }
  .panel-header > span { font-size: 11px; }
  .modal { padding: 14px; }
  .modal-content { padding: 30px 24px; }
  .agreement-header { padding: 24px 22px 16px; }
  .agreement-body { padding: 8px 24px 20px; }
  .modal-footer { padding: 0 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
