:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --border: #e2e8f0;
  --item-bg: #fafafa;
  --body: #475569;
  --code: #dc2626;
  --code-bg: #fef2f2;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --faint: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: #1e3a5f;
    --border: #334155;
    --item-bg: #0f172a;
    --body: #cbd5e1;
    --code: #f87171;
    --code-bg: #3b1d1d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, "Microsoft YaHei", sans-serif;
  max-width: 700px;
  margin: 40px auto;
  padding: 0 20px;
  background: var(--bg);
  color: var(--text);
}

h1 { text-align: center; color: var(--text); }
h2 { margin: 0; color: var(--text); }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.hint { text-align: center; color: var(--muted); margin: 0 0 8px; }

#address {
  font-size: 22px;
  font-weight: bold;
  color: var(--primary);
  cursor: pointer;
  padding: 12px;
  background: var(--primary-soft);
  border-radius: 8px;
  text-align: center;
  user-select: all;
  word-break: break-all;
}

.btn-group { display: flex; gap: 10px; margin-top: 12px; }

button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: var(--primary-hover); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.history { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  flex: none;
  padding: 4px 10px;
  font-size: 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.chip:hover { background: var(--primary-soft); }
.chip.active { color: var(--primary); border-color: var(--primary); }

#turnstile { display: flex; justify-content: center; margin-top: 12px; }
#turnstile:empty { margin: 0; }

.inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.status { font-size: 12px; color: var(--faint); }

.email-item {
  border: 1px solid var(--border);
  padding: 16px;
  margin: 12px 0;
  border-radius: 8px;
  background: var(--item-bg);
  word-break: break-word;
}
.email-item.is-new { animation: flash 2.5s ease-out; }
@keyframes flash {
  from { background: var(--primary-soft); }
  to { background: var(--item-bg); }
}

.email-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.email-subject { font-weight: bold; }

.code-box {
  font-size: 28px;
  color: var(--code);
  font-weight: bold;
  background: var(--code-bg);
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  margin: 10px 0;
  cursor: pointer;
}
.code-hint { font-size: 12px; font-weight: normal; color: var(--faint); }

.email-body { color: var(--body); font-size: 14px; white-space: pre-wrap; margin-top: 6px; }
.email-body.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-btn {
  flex: none;
  background: none;
  color: var(--primary);
  padding: 4px 0;
  margin-top: 4px;
  font-size: 13px;
}
.link-btn:hover { background: none; text-decoration: underline; }

.empty-state { text-align: center; color: var(--faint); padding: 40px 0; }
.footnote { text-align: center; color: var(--faint); font-size: 12px; margin: 16px 0 0; }