:root {
  --bg: #0b0f14;
  --panel: #121925;
  --panel-2: #17202e;
  --line: #24303f;
  --text: #e6edf5;
  --muted: #8b9bb0;
  --accent: #4c8dff;
  --accent-2: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* 全局兜底：任何带 hidden 属性的元素都必须隐藏（否则 .code-strip 的 flex 会覆盖它） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #16233a 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  max-width: 860px;
  margin: 0 auto;
}

.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.logo { font-size: 20px; }
.name { font-size: 20px; letter-spacing: .3px; }
.domain { color: var(--muted); font-size: 13px; font-weight: 400; }

.ghost { color: var(--muted); text-decoration: none; font-size: 14px; }
.ghost:hover { color: var(--text); }

main { max-width: 860px; margin: 0 auto; padding: 8px 20px 60px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.address-card { margin-bottom: 26px; }

.label { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

.address-row { display: flex; gap: 10px; align-items: center; }

.address {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(15px, 4.2vw, 22px);
  letter-spacing: .4px;
  background: #0d141d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: nowrap;
}

.address-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 14px;
  transition: .15s ease;
}
button:hover { border-color: #35506f; background: #1b2636; }
button:active { transform: translateY(1px); }

.primary {
  background: linear-gradient(180deg, #3f7ef0, #2f67cf);
  border-color: #3f7ef0;
  font-weight: 600;
}
.primary:hover { background: linear-gradient(180deg, #4c8dff, #3a74dd); border-color: #4c8dff; }

.icon-btn { padding: 7px 11px; font-size: 13px; color: var(--muted); }
.icon-btn:hover { color: var(--text); }

.muted { color: var(--muted); font-size: 13px; }

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

.inbox-head h2 { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 8px; }

.badge {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.status { display: flex; align-items: center; gap: 8px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.dot.ok { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.dot.err { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.15); }

.empty { text-align: center; padding: 46px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-icon { font-size: 34px; margin-bottom: 6px; }
.empty p { margin: 4px 0; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.mail {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: .15s ease;
}
.mail:hover { border-color: #35506f; background: #16202e; }

.avatar {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 10px;
  background: #1d2a3b;
  display: grid; place-items: center;
  font-weight: 700; color: #9fc0ff; text-transform: uppercase;
}

.mail-main { flex: 1; min-width: 0; }
.mail-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mail-from { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-time { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.mail-subject { font-weight: 600; margin: 2px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.35);
  color: #6ee7a0;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 15px;
  letter-spacing: 2px;
  flex: 0 0 auto;
  align-self: center;
}

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,7,12,.72); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(82vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  overflow: hidden;
}

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-title h3 { margin: 0 0 4px; font-size: 16px; }
.modal-title .muted { font-size: 12px; }

.code-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: rgba(34,197,94,.08);
  border-bottom: 1px solid rgba(34,197,94,.2);
}
.code-strip strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: 3px; color: #6ee7a0; }
.code-strip button { margin-left: auto; }

.modal-tabs { display: flex; gap: 6px; padding: 10px 18px 0; }
.tab { padding: 6px 12px; font-size: 13px; color: var(--muted); background: transparent; border-color: transparent; }
.tab.active { color: var(--text); background: var(--panel-2); border-color: var(--line); }

.modal-body { padding: 14px 18px 18px; overflow: auto; }
.mail-frame { width: 100%; height: min(52vh, 520px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mail-text { white-space: pre-wrap; word-break: break-word; font: 13px/1.7 ui-monospace, Menlo, Consolas, monospace; color: #c9d6e5; margin: 0; }

.help-body { color: var(--text); font-size: 14px; }
.help-body ol { padding-left: 20px; }
.help-body li { margin: 6px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1e2a3a;
  border: 1px solid #35506f;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 80;
  animation: rise .18s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 520px) {
  .mail-time { display: none; }
  .code-chip { font-size: 13px; padding: 3px 8px; }
}
