/* ==========================================================================
   工作取舍测试 · 基础层
   设计方向：清新自然绿 + 暖白 + 深绿文字 + 适度毛玻璃
   所有颜色、圆角、阴影、模糊强度都从这里取，页面样式不得写死颜色。
   ========================================================================== */

:root {
  /* ---------- 主题色 ---------- */
  --paper:        #f6f8ef;   /* 页面底色：暖白偏绿 */
  --paper-deep:   #e7efd9;   /* 柔和浅绿 */
  --surface:      #fffdf8;   /* 暖白卡片 */

  /* 品牌绿阶 */
  --brand-lite:   #b5d07b;   /* 浅草绿：装饰、进度 */
  --brand-soft:   #e7efd9;   /* 柔和浅绿：胶囊底、选中态 */
  --brand:        #668b3d;   /* 主品牌绿 */
  --brand-deep:   #4a6b2c;   /* 深一档：hover */
  --brand-ink:    #2d4527;   /* 深绿：标题、主按钮 */

  /* 文字 */
  --ink:          #283228;
  --ink-2:        #4a5548;
  --ink-3:        #697368;
  --ink-4:        #8b9487;

  /* 分隔与描边 */
  --line:         #dce5d2;
  --line-soft:    #e9efdf;

  /* 兼容别名：旧代码引用 --accent* 与 --sage，统一指向品牌绿，避免散落改色 */
  --accent:       var(--brand);
  --accent-deep:  var(--brand-deep);
  --accent-soft:  var(--brand-soft);
  --sage:         var(--brand-deep);

  /* ---------- 毛玻璃 ---------- */
  --glass-bg:        rgba(255, 253, 248, .62);
  --glass-bg-strong: rgba(255, 253, 248, .80);
  --glass-border:    rgba(255, 255, 255, .72);
  --glass-edge:      rgba(102, 139, 61, .16);
  --glass-blur:      18px;
  --glass-shadow:    0 20px 44px -26px rgba(45, 69, 39, .34),
                     0 2px 10px -6px rgba(45, 69, 39, .10);

  /* ---------- 字体 ---------- */
  /* 现代黑体：标题用较重字重，正文正常字重 */
  --font-display: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC",
                  "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-body:    "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC",
                  "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-num:     "SF Pro Display", "Helvetica Neue", "Segoe UI", var(--font-body);

  /* 字阶 */
  --fs-display: clamp(28px, 7.6vw, 40px);
  --fs-lead:    clamp(14px, 3.6vw, 16px);
  --fs-h1:      clamp(21px, 5.4vw, 25px);
  --fs-h2:      18px;
  --fs-base:    15px;
  --fs-sm:      13px;
  --fs-xs:      12px;

  /* 字重 */
  --fw-heavy: 800;
  --fw-bold:  700;
  --fw-mid:   600;

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 44px;
  --sp-8: 64px;

  /* 形状 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* 阴影（绿色调，避免灰黑发脏） */
  --sh-1: 0 2px 8px -4px rgba(45, 69, 39, .16);
  --sh-2: 0 14px 30px -18px rgba(45, 69, 39, .30);
  --sh-3: 0 26px 56px -28px rgba(45, 69, 39, .36);

  /* 动效 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 160ms;
  --t-base: 300ms;
  --t-slow: 620ms;

  --page-max: 560px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  /* 参考首页预览图的光感：顶部暖白光晕 + 右下浅绿 + 左下草绿 */
  background-image:
    radial-gradient(58% 42% at 74% -6%, rgba(181, 208, 123, .40) 0%, rgba(181, 208, 123, 0) 62%),
    radial-gradient(46% 34% at 12% 4%, rgba(255, 253, 240, .95) 0%, rgba(255, 253, 240, 0) 58%),
    radial-gradient(72% 52% at 104% 96%, rgba(181, 208, 123, .28) 0%, rgba(181, 208, 123, 0) 66%),
    linear-gradient(180deg, #f8faf1 0%, #f4f7ec 46%, #eef3e3 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main, header, footer { position: relative; z-index: 1; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: -.012em;
  line-height: 1.28;
  margin: 0;
  color: var(--brand-ink);
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

img { max-width: 100%; display: block; }

/* ---------- 通用毛玻璃 ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.15);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.15);
}

/* 不支持毛玻璃时退回不透明暖白，绝不出现"半透明糊字" */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .glass { background: rgba(255, 253, 248, .97); }
}

/* ---------- 布局 ---------- */
.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-7);
}

.page--wide { max-width: 720px; }

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: var(--sp-5) 0;
}

.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }

/* ---------- 图标 ---------- */
.brand-icon {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0 auto var(--sp-4);
  display: grid;
  place-items: center;
  color: var(--brand-ink);
  border-radius: 22px;
  background:
    linear-gradient(158deg, rgba(255, 255, 252, .96) 0%, rgba(214, 231, 186, .94) 100%);
  border: 1px solid rgba(255, 255, 255, .88);
  box-shadow:
    0 14px 28px -16px rgba(45, 69, 39, .48),
    0 2px 6px -2px rgba(45, 69, 39, .14),
    inset 0 1px 0 rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.brand-icon svg { width: 34px; height: 34px; display: block; }

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: rgba(255, 253, 248, .92);
  --btn-fg: var(--brand-ink);
  --btn-line: rgba(102, 139, 61, .34);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  min-width: 120px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-pill);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-base);
  font-weight: var(--fw-mid);
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out),
              background-color var(--t-fast) ease,
              border-color var(--t-fast) ease,
              box-shadow var(--t-fast) ease;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
.btn:hover { border-color: rgba(102, 139, 61, .55); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(1px) scale(.995); }

/* 主按钮：深绿填充 + 白字 */
.btn--primary,
.btn--accent {
  --btn-bg: linear-gradient(180deg, #5d7f37 0%, #3f5d26 100%);
  --btn-fg: #fbfdf6;
  --btn-line: rgba(45, 69, 39, .9);
  box-shadow:
    0 12px 26px -16px rgba(45, 69, 39, .70),
    inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn--primary:hover,
.btn--accent:hover {
  --btn-bg: linear-gradient(180deg, #668b3d 0%, #47682c 100%);
  border-color: rgba(45, 69, 39, .95);
  box-shadow: 0 16px 30px -18px rgba(45, 69, 39, .74);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn--ghost:hover { background: rgba(102, 139, 61, .08); border-color: transparent; }

.btn--block { width: 100%; }
.btn--wide { min-width: 180px; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .45;
  pointer-events: none;
  box-shadow: none;
}

.btn.is-loading { pointer-events: none; color: transparent; position: relative; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: spin .8s linear infinite;
}
.btn--ghost.is-loading::after,
.btn:not(.btn--primary):not(.btn--accent).is-loading::after { color: var(--brand-ink); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 焦点可见 ---------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- 胶囊 ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  border: 1px solid rgba(102, 139, 61, .22);
  color: var(--brand-ink);
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  letter-spacing: .06em;
  line-height: 1.6;
  max-width: 100%;
  text-align: center;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}
.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 69, 39, .34);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn var(--t-base) ease both;
}

.modal__card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: rgba(255, 253, 248, .96);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  box-shadow: var(--sh-3);
  animation: modalIn var(--t-base) var(--ease-out) both;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.modal__close {
  position: absolute;
  top: 10px; right: 10px;
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
}
.modal__close:hover { background: var(--line-soft); color: var(--ink); }

.modal__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: var(--fw-bold);
  text-align: center;
  margin-bottom: var(--sp-4);
}

.modal__actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}
.modal__actions .btn { flex: 1; min-width: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: var(--sp-4); }

.field__label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  margin-bottom: 6px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 0 var(--sp-4);
  min-height: 52px;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(102, 139, 61, .16);
}
.input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: var(--fw-mid);
  letter-spacing: .02em;
  color: var(--ink);
  padding: 12px 0;
}
.input-wrap input::placeholder { color: var(--ink-4); font-weight: 400; font-size: 16px; }
.input-wrap .unit { color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; }

.field__error {
  display: none;
  margin-top: 6px;
  color: #a4472a;
  font-size: var(--fs-sm);
}
.field.has-error .input-wrap { border-color: #a4472a; }
.field.has-error .field__error { display: block; }

.field__hint { margin-top: 6px; font-size: var(--fs-sm); color: var(--ink-3); }
.field__hint.is-warn { color: #a4472a; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  z-index: 80;
  background: var(--brand-ink);
  color: #f7fbef;
  font-size: var(--fs-sm);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  box-shadow: var(--sh-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 载入序列 ---------- */
.reveal { opacity: 0; transform: translateY(10px); animation: reveal var(--t-slow) var(--ease-out) forwards; }
.reveal-1 { animation-delay: 40ms; }
.reveal-2 { animation-delay: 120ms; }
.reveal-3 { animation-delay: 200ms; }
.reveal-4 { animation-delay: 280ms; }
.reveal-5 { animation-delay: 360ms; }

@keyframes reveal { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 页脚 ---------- */
.site-foot {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--sp-5) var(--sp-6);
  color: var(--ink-4);
  font-size: var(--fs-xs);
  text-align: center;
  letter-spacing: .06em;
}
