:root {
  --ink: #14231d;
  --muted: #68766f;
  --paper: #f5f6f1;
  --card: #ffffff;
  --green: #16745f;
  --green-dark: #0d5243;
  --green-soft: #dcece6;
  --blue: #386a86;
  --blue-soft: #e1edf2;
  --amber: #a46c1c;
  --amber-soft: #f4ead4;
  --red: #b24a40;
  --red-soft: #f4e1df;
  --line: #dbe1dc;
  --shadow: 0 18px 55px rgba(22, 48, 37, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: var(--green-dark); }
[hidden] { display: none !important; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr); }
.auth-story { display: flex; min-height: 100vh; flex-direction: column; justify-content: center; padding: clamp(48px, 8vw, 120px); color: #fff; background: radial-gradient(circle at 75% 20%, rgba(255,255,255,.13), transparent 30%), linear-gradient(145deg, #143e33, #0a2e26); }
.brand-mark { position: absolute; top: 42px; font-size: 22px; font-weight: 850; letter-spacing: -.5px; }
.brand-mark span { margin-left: 6px; padding: 3px 7px; border-radius: 20px; color: #163e33; background: #d9eee5; font-size: 11px; vertical-align: middle; }
.story-kicker { margin: 0 0 20px; color: #b8d9cb; font-weight: 700; letter-spacing: .08em; }
.auth-story h1 { max-width: 680px; margin: 0; font-size: clamp(44px, 6vw, 86px); line-height: 1.1; letter-spacing: -.05em; }
.story-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 42px; }
.story-flow span { padding: 10px 14px; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; background: rgba(255,255,255,.07); font-weight: 700; }
.story-flow i { color: #83bba4; font-style: normal; }
.story-note { margin-top: 26px; color: #9bc3b2; }
.auth-card { display: flex; min-height: 100vh; flex-direction: column; justify-content: center; padding: clamp(36px, 6vw, 86px); background: #fff; }
.auth-tabs { display: flex; gap: 26px; margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.auth-tab { padding: 0 0 13px; border: 0; color: var(--muted); background: transparent; font-weight: 750; }
.auth-tab.is-active { border-bottom: 3px solid var(--green); color: var(--green-dark); }
.auth-form { display: grid; gap: 17px; max-width: 520px; }
.form-heading p { margin: 0 0 8px; color: var(--green); font-size: 13px; font-weight: 750; }
.form-heading h2 { margin: 0 0 18px; font-size: 32px; letter-spacing: -.03em; }
label { display: grid; gap: 8px; }
label > span { color: #425049; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #cbd5cf; border-radius: 8px; color: var(--ink); background: #fff; outline: none; }
textarea { min-height: 96px; padding-top: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,116,95,.1); }
.captcha-row, .otp-row { display: grid; grid-template-columns: 1fr 160px; align-items: end; gap: 12px; }
.optional-verification { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--green-soft); }
.optional-verification > p { margin: 0; color: var(--muted); font-size: 13px; }
.captcha-image { height: 56px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #eef4ef; }
.captcha-image img { width: 100%; height: 100%; object-fit: cover; }
.consent-line { display: flex; grid-column: 1 / -1; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.consent-line input { width: 17px; min-height: 17px; margin-top: 2px; }
.consent-line span { font-weight: 500; }
.button { min-height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: 8px; font-weight: 780; }
.primary-button { color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { border-color: #aac2b7; color: var(--green-dark); background: #fff; }
.text-button { color: var(--muted); background: transparent; }
.form-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 13px; }
.form-message.error { color: var(--red); }
.form-message.success { color: var(--green); }
.auth-footnote { max-width: 520px; margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.topbar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 68px; padding: 0 40px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); }
.brand-button { justify-self: start; border: 0; background: transparent; }
.brand-button strong { font-size: 20px; }
.brand-button span { margin-left: 6px; padding: 3px 7px; border-radius: 20px; color: var(--green-dark); background: var(--green-soft); font-size: 10px; }
#main-nav { display: flex; gap: 8px; }
.nav-button { padding: 9px 14px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-weight: 720; }
.nav-button.is-active { color: var(--green-dark); background: var(--green-soft); }
.account-area { display: flex; justify-self: end; align-items: center; gap: 14px; }
.account-area span { display: flex; flex-direction: column; text-align: right; }
.account-area small { color: var(--muted); }
.account-area button { border: 0; color: var(--muted); background: transparent; }

main { min-height: calc(100vh - 132px); }
.view { display: none; }
.view.is-visible { display: block; }
.page-wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.narrow-wrap { width: min(960px, calc(100% - 40px)); }
.home-header { display: flex; justify-content: space-between; gap: 30px; align-items: flex-start; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 13px; font-weight: 780; letter-spacing: .06em; }
.home-header h1, .page-header h1 { margin: 0; font-size: clamp(38px, 5vw, 62px); letter-spacing: -.045em; }
.home-header > div:first-child > p:last-child { margin: 14px 0 0; color: var(--muted); }
.points-card { min-width: 170px; padding: 20px 22px; border: 1px solid #c7dbd1; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.points-card span, .points-card small { display: block; color: var(--muted); font-size: 12px; }
.points-card strong { display: block; margin: 5px 0; color: var(--green); font-size: 32px; }
.membership-alert { margin-top: 26px; padding: 14px 18px; border: 1px solid #e3c69b; border-radius: 9px; color: #7a521a; background: var(--amber-soft); }
.core-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 42px; }
.core-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 250px; padding: 40px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; text-align: left; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.core-card:not(:disabled):hover { transform: translateY(-4px); box-shadow: 0 22px 60px rgba(22,48,37,.13); }
.review-card { color: #15384a; background: linear-gradient(145deg, #edf5f8, var(--blue-soft)); }
.new-card { color: #173d32; background: linear-gradient(145deg, #eef6f1, var(--green-soft)); }
.core-number { display: grid; width: 112px; height: 112px; place-items: center; margin-right: 28px; border-radius: 50%; color: #fff; background: var(--blue); font-size: 46px; font-weight: 850; }
.new-card .core-number { background: var(--green); }
.core-copy { display: flex; flex-direction: column; }
.core-copy small { opacity: .66; font-weight: 750; }
.core-copy strong { margin: 8px 0; font-size: 34px; }
.core-copy em { font-style: normal; opacity: .75; }
.core-arrow { font-size: 34px; }
.core-card.is-locked::after { position: absolute; inset: 0; display: grid; place-items: center; content: "先完成抗遗忘"; color: #755325; background: rgba(250,245,231,.88); font-weight: 800; }
.today-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 30px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.today-summary div { padding: 22px 26px; }
.today-summary div + div { border-left: 1px solid var(--line); }
.today-summary strong, .today-summary span { display: block; }
.today-summary strong { font-size: 28px; }
.today-summary span { margin-top: 5px; color: var(--muted); font-size: 12px; }

.study-wrap { width: min(1080px, calc(100% - 34px)); margin: 0 auto; padding: 28px 0 70px; }
.study-topline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.back-button { justify-self: start; border: 0; color: var(--muted); background: transparent; }
.study-topline > div { display: flex; gap: 14px; }
.study-topline > div span { color: var(--green); font-weight: 750; }
.study-points { justify-self: end; color: var(--muted); }
.study-points b { color: var(--green); }
.progress-track { height: 6px; margin: 18px 0 25px; border-radius: 6px; background: #dce3de; }
.progress-track div { width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .22s ease; }
.word-card { position: relative; min-height: 690px; padding: 28px 46px 32px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.word-card-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.countdown-ring { position: absolute; top: 75px; left: 50%; display: grid; width: 76px; height: 76px; place-items: center; border: 5px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; transform: translateX(-50%); }
.countdown-ring strong { font-size: 25px; line-height: 1; }
.countdown-ring span { color: var(--muted); font-size: 9px; }
.word-display { padding-top: 145px; font-size: clamp(72px, 11vw, 130px); font-weight: 900; line-height: 1; text-align: center; letter-spacing: -.055em; overflow-wrap: anywhere; }
.phonetic { margin-top: 18px; color: var(--muted); font-size: 23px; text-align: center; }
.repeat-instruction { width: fit-content; margin: 26px auto 0; padding: 9px 14px; border-radius: 20px; color: var(--green-dark); background: var(--green-soft); font-size: 13px; font-weight: 760; }
.meaning-reveal { min-height: 50px; margin-top: 24px; font-size: 34px; font-weight: 850; text-align: center; }
.voice-status { display: flex; max-width: 620px; min-height: 88px; align-items: center; gap: 16px; margin: 18px auto 0; padding: 18px 22px; border-radius: 12px; background: #f5f7f5; }
.voice-dot { flex: 0 0 15px; width: 15px; height: 15px; border-radius: 50%; background: #8d9a94; }
.voice-status[data-status="listening"] .voice-dot { background: var(--red); animation: pulse 1s infinite; }
.voice-status[data-status="playing"] .voice-dot { background: var(--amber); }
.voice-status[data-status="success"] { background: #e9f5ef; }
.voice-status[data-status="success"] .voice-dot { background: var(--green); }
.voice-status[data-status="error"] { background: var(--red-soft); }
.voice-status[data-status="error"] .voice-dot { background: var(--red); }
.voice-status strong { display: block; }
.voice-status p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(178,74,64,.13); } }
.manual-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.manual-controls button { min-height: 40px; padding: 0 14px; border: 1px solid #c8d4cd; border-radius: 7px; color: var(--muted); background: #fff; }
.manual-controls button:last-child { border-color: #e2bbb6; color: var(--red); }
.study-finished { padding: 130px 20px; text-align: center; }
.finish-icon { display: grid; width: 80px; height: 80px; place-items: center; margin: 0 auto 24px; border-radius: 50%; color: #fff; background: var(--green); font-size: 38px; }
.study-finished h2 { margin: 0; font-size: 38px; }
.study-finished p { max-width: 520px; margin: 16px auto 28px; color: var(--muted); line-height: 1.7; }

.page-header { margin-bottom: 34px; }
.panel { margin-top: 24px; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin-top: 0; }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-heading h2 { margin: 0; }
.panel-heading p, .rewards-form > p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.status-pill { height: fit-content; padding: 7px 10px; border-radius: 20px; color: var(--green-dark); background: var(--green-soft); font-size: 11px; font-weight: 750; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.full-row { grid-column: 1 / -1; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 10px; }
.metric-grid div { padding: 19px; }
.metric-grid div + div { border-left: 1px solid var(--line); }
.metric-grid strong, .metric-grid span { display: block; }
.metric-grid strong { font-size: 26px; }
.metric-grid span { color: var(--muted); font-size: 11px; }
.settings-form, .rewards-form, .privacy-links { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--line); }
.settings-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; align-items: end; gap: 14px; }
.settings-form h3 { grid-column: 1 / -1; }
#reward-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.privacy-links { display: flex; flex-wrap: wrap; gap: 16px; }
.privacy-links h3 { width: 100%; }
.privacy-actions { display: grid; gap: 14px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.privacy-actions h3, .privacy-actions p { margin: 0; }
.privacy-actions > p { color: var(--muted); }
.privacy-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.request-list { display: grid; gap: 8px; }
.request-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--paper); color: var(--muted); font-size: 13px; }
.operator-request { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.operator-request p { margin: 5px 0 0; color: var(--muted); }
.operator-request-actions { display: flex; flex-shrink: 0; gap: 8px; }
.file-button { display: inline-grid; place-items: center; margin-right: 8px; cursor: pointer; }
.membership-list { display: grid; gap: 0; }
.membership-row { display: flex; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--line); }
.membership-row span { color: var(--muted); font-size: 13px; }
.empty-copy { color: var(--muted); }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; padding: 25px 30px; border-top: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 11px; }
.site-footer a { color: var(--muted); }
.toast { position: fixed; z-index: 50; bottom: 28px; left: 50%; max-width: calc(100vw - 30px); padding: 12px 17px; border-radius: 8px; color: #fff; background: #1b2e26; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8, 28, 22, .68); backdrop-filter: blur(8px); }
.modal-card { width: min(520px, 100%); padding: 32px; border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.modal-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: var(--red); background: var(--red-soft); }
.modal-card h2 { margin: 18px 0 10px; }
.modal-card p { color: var(--muted); line-height: 1.75; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-story { min-height: 390px; padding: 90px 30px 45px; }
  .brand-mark { top: 26px; }
  .auth-story h1 { font-size: 45px; }
  .auth-card { min-height: auto; padding: 42px 24px 60px; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; }
  #main-nav { position: fixed; z-index: 30; bottom: 0; left: 0; width: 100%; justify-content: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
  .account-area span { display: none; }
  .site-footer { padding-bottom: 90px; }
  .home-header { display: grid; }
  .points-card { width: 100%; }
  .core-actions { grid-template-columns: 1fr; }
  .core-card { min-height: 210px; padding: 28px; }
  .today-summary { grid-template-columns: 1fr 1fr; }
  .today-summary div:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .today-summary div:nth-child(4) { border-top: 1px solid var(--line); }
  .word-card { min-height: 650px; padding-inline: 20px; }
  .word-display { font-size: 74px; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-form h3 { grid-column: auto; }
}

@media (max-width: 560px) {
  .captcha-row, .otp-row, .grid-form { grid-template-columns: 1fr; }
  .captcha-image { width: 160px; }
  .home-header h1, .page-header h1 { font-size: 39px; }
  .core-card { grid-template-columns: auto 1fr; min-height: 180px; padding: 24px 20px; }
  .core-number { width: 72px; height: 72px; margin-right: 17px; font-size: 30px; }
  .core-copy strong { font-size: 27px; }
  .core-arrow { display: none; }
  .study-topline { grid-template-columns: 1fr 1fr; }
  .study-topline > div { display: none; }
  .study-points { display: block !important; }
  .countdown-ring { top: 65px; width: 66px; height: 66px; }
  .word-display { padding-top: 132px; font-size: 64px; }
  .manual-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid div:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .metric-grid div:nth-child(4) { border-top: 1px solid var(--line); }
  #reward-fields { grid-template-columns: 1fr; }
  .membership-row { display: grid; gap: 5px; }
}
