/* ==========================================================================
   元宝账号认证 · 留言板
   设计基调：暖白纸感 + 单一墨绿强调色，细边框、克制圆角、大量留白。
   刻意避开：蓝紫渐变、玻璃拟态、霓虹发光、大阴影。
   ========================================================================== */

:root {
  /* 中性色（暖灰 / 米白） */
  --paper: #faf9f7;
  --paper-raised: #ffffff;
  --paper-sunken: #f3f1ed;
  --ink: #1c1b19;
  --ink-soft: #4a4742;
  --ink-muted: #7c7770;
  --line: #e2ded7;
  --line-strong: #cfc9c0;

  /* 单一强调色：深墨绿 */
  --accent: #1f4d3d;
  --accent-hover: #17392d;
  --accent-soft: #eaf0ec;
  --accent-ink: #faf9f7;

  /* 语义色（克制，不喧宾夺主） */
  --ok: #2f6b4f;
  --warn: #8a5a1e;
  --danger: #96402f;

  --radius: 5px;
  --radius-sm: 4px;
  --shell: 1080px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--paper-sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.05em 0.32em;
}

.muted { color: var(--ink-muted); }

/* ---------- 外壳 ---------- */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(18px, 4vw, 32px) 40px;
}

/* ---------- 页头 ---------- */

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: clamp(24px, 4vw, 36px);
  border-bottom: 1px solid var(--line);
}

.masthead__main { max-width: 620px; }

.masthead__eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.masthead h1 {
  font-size: clamp(24px, 3.6vw, 34px);
  line-height: 1.28;
}

.lede {
  margin: 12px 0 0;
  color: var(--ink-soft);
  max-width: 56ch;
}

.masthead__side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding-top: 4px;
}

.chip {
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink-muted);
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--mock {
  cursor: default;
  border-style: dashed;
  border-color: var(--warn);
  color: var(--warn);
  background: transparent;
}

/* ---------- 栅格 ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(18px, 2.6vw, 28px);
  align-items: start;
  padding-top: clamp(24px, 4vw, 36px);
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card__head h2 { font-size: 17px; }

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: none;
  transition: background-color 0.2s;
}
.state-dot[data-state="pending"] { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.state-dot[data-state="success"] { background: var(--ok); }
.state-dot[data-state="rejected_bot"] { background: var(--warn); }
.state-dot[data-state="expired"] { background: var(--ink-muted); }
.state-dot[data-state="error"] { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.panel[hidden] { display: none; }

.hint {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

.fineprint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---------- 按钮 ---------- */

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn:focus-visible,
.input:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn--text {
  background: none;
  border: none;
  padding: 4px 2px;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
}
.btn--text:hover:not(:disabled) { color: var(--accent); }

.btn--tiny { padding: 7px 12px; font-size: 13px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.actions--quiet { margin-top: 14px; }

/* ---------- 验证码 ---------- */

.code-box {
  position: relative;
  background: var(--paper-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  text-align: center;
}

.code-box__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.code {
  display: block;
  font-family: var(--mono);
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink);
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
  line-height: 1.2;
  min-height: 1.2em;
}

.code-box .btn { margin-top: 14px; }

/* ---------- 倒计时 ---------- */

.countdown { margin-top: 20px; }

.countdown__track {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.countdown__fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: width 0.4s linear, background-color 0.4s;
}

.countdown__track.is-low .countdown__fill { background: var(--warn); }

.countdown__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- 步骤 ---------- */

.steps {
  margin: 22px 0 0;
  padding: 0 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
}
.steps li { margin-bottom: 7px; padding-left: 4px; }
.steps li::marker { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.steps li:last-child { margin-bottom: 0; }

/* ---------- 状态行 ---------- */

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-muted);
}

.status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: pulse 1.6s ease-in-out infinite;
}

/* ---------- 结果态 ---------- */

.state { padding: 4px 0 0; }

.state__kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.state__title { font-size: 20px; margin-bottom: 10px; }

.state__desc {
  margin: 0;
  color: var(--ink-soft);
  max-width: 46ch;
}

.state__meta {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  word-break: break-all;
}

.state--ok .state__kicker { color: var(--ok); }
.state--warn .state__kicker { color: var(--warn); }
.state--danger .state__kicker { color: var(--danger); }
.state--muted .state__kicker { color: var(--ink-muted); }

.facts {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--paper-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 16px;
  font-size: 13px;
}
.facts[hidden] { display: none; }
.facts dt { color: var(--ink-muted); }
.facts dd {
  margin: 0;
  font-family: var(--mono);
  word-break: break-all;
}

/* ---------- 留言板表单 ---------- */

.field { margin-bottom: 14px; }

.field__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.input::placeholder { color: #a9a39b; }
.input:hover { border-color: var(--ink-muted); }
.input:focus { border-color: var(--accent); outline: none; }

.input--area {
  resize: vertical;
  min-height: 84px;
  line-height: 1.6;
}

.board-form__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.counter {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.counter.is-over { color: var(--danger); }

.board-status {
  margin: 14px 0 0;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper-sunken);
  color: var(--ink-soft);
}
.board-status[hidden] { display: none; }
.board-status[data-tone="ok"] { border-color: #c8dcd1; background: #f1f7f3; color: var(--ok); }
.board-status[data-tone="error"] { border-color: #e6cfc9; background: #fbf2f0; color: var(--danger); }

/* ---------- 留言列表 ---------- */

.messages {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.message {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.message:last-child { border-bottom: none; padding-bottom: 4px; }

.message__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.message__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message__time {
  font-size: 12px;
  color: var(--ink-muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.message__body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  margin: 22px 0 0;
  padding: 26px 0;
  text-align: center;
  font-size: 14px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
}
.empty[hidden] { display: none; }

/* ---------- 页脚 ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(32px, 5vw, 48px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .masthead { flex-direction: column; }
  .masthead__side { padding-top: 0; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .shell { padding-left: 16px; padding-right: 16px; }
  .card { padding: 18px 16px; }
  .actions .btn { flex: 1 1 auto; }
  .code { letter-spacing: 0.1em; }
  .footer { flex-direction: column; gap: 4px; }
}

/* ---------- 无障碍 / 动效偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media (prefers-color-scheme: dark) {
  /* 保持一致的暖中性调，只是压暗，不用蓝紫 */
  :root {
    --paper: #171614;
    --paper-raised: #1e1d1a;
    --paper-sunken: #131211;
    --ink: #ece8e1;
    --ink-soft: #b8b2a9;
    --ink-muted: #8b857c;
    --line: #2c2a27;
    --line-strong: #3d3a35;
    --accent: #7fb69b;
    --accent-hover: #93c4ac;
    --accent-ink: #14180f;
    --accent-soft: #22302a;
    --ok: #7fb69b;
    --warn: #cfa26a;
    --danger: #d08a78;
  }
  code { background: var(--paper-sunken); }
  .board-status[data-tone="ok"] { border-color: #2f4438; background: #1a221d; }
  .board-status[data-tone="error"] { border-color: #4a2f2a; background: #241b19; }
  .input::placeholder { color: #6b665f; }
}

/* 留言板绑定提示条 */
.bind-hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f6f4f0;
  border: 1px solid #e6e1d9;
  border-radius: 5px;
  font-size: 13px;
  color: #5c5851;
  line-height: 1.5;
}

.bind-hint[hidden] {
  display: none;
}

/* 未绑定时输入框置灰 */
.input:disabled {
  background: #f6f4f0;
  color: #a09b94;
  cursor: not-allowed;
}

/* 验证群号提示 */
.group-box {
  margin: 0 0 16px;
  padding: 14px;
  background: #eaf0ec;
  border: 1px solid #cfdcd4;
  border-radius: 5px;
}

.group-box[hidden] { display: none; }

.group-box__label {
  display: block;
  font-size: 12px;
  color: #4a5a52;
  margin-bottom: 8px;
}

.group-box__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.group-box__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #1f4d3d;
  background: #fff;
  border: 1px solid #cfdcd4;
  border-radius: 4px;
  padding: 6px 12px;
  user-select: all;
}

.group-box__hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #5c6b63;
}

.steps b { color: #1c1b19; }
