:root {
  --bg: #f6f8fb;
  --bg-card: #ffffff;
  --bg-soft: #f0f4fa;
  --text: #1a2233;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --primary: #2f7cf6;
  --primary-hover: #1f67d6;
  --primary-soft: #e8f1fe;
  --green: #16a34a;
  --red: #ef4444;
  --orange: #f59e0b;
  --border: #e5eaf2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 8px 28px rgba(16, 24, 40, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.icon { width: 16px; height: 16px; flex-shrink: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 26px; height: 26px; color: var(--primary); }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions .btn { text-decoration: none; }

.wrap { max-width: 680px; margin: 0 auto; padding: 28px 20px 40px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 13px 22px;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 14px rgba(47, 124, 246, 0.28); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.btn-link {
  background: none;
  color: var(--primary);
  padding: 0;
  font-size: 13px;
  font-weight: 500;
}
.btn-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---------- 邮箱卡片 ---------- */
.mailbox-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.mailbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.mailbox-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}
.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}
.timer .icon { width: 17px; height: 17px; }
.timer.warning { color: var(--red); }

.mailbox-address-wrap {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.mailbox-address {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: box-shadow 0.18s ease;
}
.mailbox-address:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(47, 124, 246, 0.14);
}
.mailbox-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
}
.hint { font-size: 13px; color: var(--text-dim); }

/* ---------- 加载 ---------- */
.loading {
  display: none;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.loading.active { display: block; }
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 收件箱 ---------- */
.inbox { margin-top: 26px; }
.inbox-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.inbox-title { font-size: 18px; font-weight: 700; }
.count-badge {
  background: var(--primary);
  color: #fff;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auto-refresh {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
}

.inbox-list { display: flex; flex-direction: column; gap: 10px; }

.mail-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mail-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.mail-item.unread { border-left: 3px solid var(--primary); padding-left: 13px; }
.mail-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.mail-from {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.mail-time { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.mail-subject {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-preview {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-icon { width: 44px; height: 44px; color: var(--text-dim); margin-bottom: 12px; }
.empty p { font-size: 14px; }
.empty-hint { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }

/* ---------- FAQ 折叠 ---------- */
.faq-fold {
  margin-top: 26px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.faq-fold summary {
  cursor: pointer;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}
.faq-fold summary::-webkit-details-marker { display: none; }
.faq-fold summary:hover { color: var(--primary); }
.faq-body { padding: 4px 18px 18px; border-top: 1px solid var(--border); }
.intro-block { font-size: 13.5px; color: var(--text-muted); margin: 12px 0 16px; line-height: 1.7; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}
.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step strong { font-size: 13px; display: block; }
.step p { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }
.mini-faq { margin-top: 16px; font-size: 13px; }
.mini-faq dt { font-weight: 600; color: var(--text); margin-top: 10px; }
.mini-faq dd { color: var(--text-muted); margin-left: 0; }

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  padding: 28px 20px 40px;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 720px;
  margin: 0 auto;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.22);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-subject { font-size: 17px; font-weight: 700; flex: 1; word-break: break-word; }
.modal-meta {
  padding: 12px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.meta-row { display: flex; gap: 10px; margin: 3px 0; }
.meta-key { color: var(--text-dim); min-width: 46px; }
.meta-val { color: var(--text); word-break: break-all; }
.modal-body {
  padding: 22px;
  color: var(--text);
  line-height: 1.8;
  word-break: break-word;
}
.modal-body iframe {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 11px 22px;
  border-radius: 22px;
  font-weight: 500;
  font-size: 13.5px;
  z-index: 2000;
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.25);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .mailbox-address-wrap { flex-direction: column; }
  .mailbox-address {
    width: 100%;
    font-size: 15px;
  }
  .mailbox-address-wrap .btn-primary { width: 100%; }
  .mailbox-foot { flex-direction: column; align-items: flex-start; gap: 8px; }
  .steps { grid-template-columns: 1fr; }
  .auto-refresh { display: none; }
}
