:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-glow: rgba(99,102,241,0.3);
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --border: #2d2d4a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
}

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

/* Icons */
.icon { width: 16px; height: 16px; flex-shrink: 0; }
.icon-lg { width: 18px; height: 18px; }
.icon-xl { width: 56px; height: 56px; }
.icon-title { width: 20px; height: 20px; margin-right: 4px; vertical-align: -3px; }

.spinning { animation: spin 0.6s ease-in-out; }

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

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon { width: 34px; height: 34px; color: var(--primary); }
.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: -2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 0 20px var(--primary-glow); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #3a3a5c; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-hover); }
.btn-icon { background: transparent; border: none; font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; color: var(--text); }
.btn-icon:hover { background: var(--border); }
.btn-link {
  background: none;
  border: none;
  color: var(--primary-hover);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  font-family: var(--font);
  padding: 0;
}

/* Mailbox */
.mailbox-section { margin-top: 32px; }
.mailbox-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.mailbox-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.mailbox-address-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.mailbox-address {
  flex: 1;
  min-width: 220px;
  padding: 14px 18px;
  background: var(--bg);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  text-align: center;
}
.mailbox-address:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.mailbox-timer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}
#countdown { color: var(--orange); font-weight: 600; }
.mailbox-info {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(99,102,241,0.1);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary-hover);
}

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

/* Inbox */
.inbox-section { margin-top: 24px; margin-bottom: 60px; }
.inbox-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.inbox-header h2 {
  font-size: 20px;
  font-weight: 600;
  flex: 1;
}
.badge {
  background: var(--primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.auto-refresh-indicator {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.auto-refresh-indicator.hidden { display: none; }

.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: 16px 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.mail-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateX(4px);
}
.mail-item.unread { border-left: 3px solid var(--primary); }
.mail-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mail-from {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-time {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.mail-subject {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-preview {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state p { margin-bottom: 8px; }
.empty-hint { font-size: 13px; color: var(--text-dim); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
}
.modal-overlay.active { display: block; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 720px;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}
.modal-meta {
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.meta-row { margin-bottom: 4px; }
.meta-label { color: var(--text-dim); }
.modal-body {
  padding: 24px;
  color: var(--text);
  line-height: 1.8;
  word-break: break-word;
}
.modal-body iframe {
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: 60px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}
.footer-col h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.footer-col p, .footer-col ul { font-size: 13px; color: var(--text-muted); }
.footer-col ul { list-style: none; }
.footer-col ul li { padding: 3px 0; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.footer-bottom a { color: var(--primary-hover); }

/* Responsive */
@media (max-width: 640px) {
  .mailbox-address-row { flex-direction: column; }
  /* 移动端输入框占满卡片宽度：column 布局下 flex:1 不再横向拉伸，
     必须显式 width:100% 并清掉 min-width，否则 23 字符地址会被
     卡在 220px 而显示不全 */
  .mailbox-address {
    width: 100%;
    min-width: 0;
    font-size: 16px; /* iOS Safari 16px 以下聚焦会触发页面自动缩放 */
    text-align: left; /* 溢出时左对齐，开头优先可见且可横向滚动查看 */
  }
  /* 移动端按钮占满宽度、等高，触控目标约 44px */
  .mailbox-address-row .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
  }
  /* timer 窄屏时允许「续期」链接换行，避免水平溢出卡片 */
  .mailbox-timer { flex-wrap: wrap; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* SEO text hidden styling */
.seo-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* SEO content sections */
.seo-section {
  margin-top: 40px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.seo-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.step {
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  margin-bottom: 10px;
}
.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p, .features li { font-size: 13px; color: var(--text-muted); }
.features { list-style: none; }
.features li { padding: 8px 0 8px 28px; position: relative; }
.features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.faq details {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.faq details:last-child { border-bottom: none; }
.faq summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}
.faq details p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #000;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  z-index: 2000;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}