/* MailInbox — 纯黑、细线、细字。唯一的视觉重点是验证码本身。 */
:root {
  --bg: #000000;
  --raise: #070707;
  --raise-2: #0c0c0c;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.18);
  --ink: #ececec;
  --ink-2: #9a9a9a;
  --ink-3: #5e5e5e;
  --signal: #c8d4ff;          /* 冷光：只用于"已识别验证码"和焦点 */
  --danger: #ff8a8a;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;
  --sans: "Inter", "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 300 15px/1.55 var(--sans);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input { font: inherit; color: inherit; }
::selection { background: rgba(200, 212, 255, 0.25); }

.shell {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}

/* ---- 邮箱输入框 ---- */
.finder { margin: 0 auto 36px; }
.finder-box {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 6px 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--raise);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.finder-box:hover { border-color: rgba(255, 255, 255, 0.28); }
.finder-box:focus-within { border-color: rgba(200, 212, 255, 0.55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 4px rgba(200, 212, 255, 0.06); }
.finder input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font: 400 17px/1 var(--mono);
  letter-spacing: 0.01em;
}
.finder input::placeholder { font-family: var(--sans); font-weight: 300; color: var(--ink-3); }
.finder-clear {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 6px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.finder-clear:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.finder-clear[hidden] { display: none; }
.finder-clear svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.finder-go {
  height: 44px;
  padding: 0 26px;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #000;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.12s var(--ease);
}
.finder-go:hover { background: #fff; }
.finder-go:active { transform: scale(0.97); }
.finder-msg { min-height: 20px; margin: 10px 22px 0; font-size: 13px; color: var(--danger); }
.finder-msg:empty { margin-top: 0; min-height: 0; }
.inbox[hidden] { display: none; }
.inbox.is-enter { animation: fade-in 0.35s var(--ease) both; }

/* ---- 验证码面板 ---- */
.code-panel {
  position: relative;
  padding: 26px 26px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.045), transparent 55%),
    var(--raise);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.4s var(--ease);
}
.code-panel.has-code { border-color: rgba(200, 212, 255, 0.28); }
.code-main { display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.code-digits { display: flex; gap: 8px; min-height: 64px; align-items: center; flex-wrap: wrap; }
.code-digits .cell {
  display: grid;
  place-items: center;
  width: 46px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--raise-2);
  font: 400 30px/1 var(--mono);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: cell-in 0.5s var(--ease) both;
}
.code-digits .cell:nth-child(2) { animation-delay: 0.03s; }
.code-digits .cell:nth-child(3) { animation-delay: 0.06s; }
.code-digits .cell:nth-child(4) { animation-delay: 0.09s; }
.code-digits .cell:nth-child(5) { animation-delay: 0.12s; }
.code-digits .cell:nth-child(6) { animation-delay: 0.15s; }
.code-digits .cell:nth-child(7) { animation-delay: 0.18s; }
.code-digits .cell:nth-child(8) { animation-delay: 0.21s; }
.has-code .code-digits .cell { border-color: rgba(200, 212, 255, 0.22); }
.code-digits .placeholder { display: flex; gap: 8px; }
.code-digits .placeholder i {
  width: 46px; height: 60px;
  border: 1px dashed rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
}
.is-waiting .code-digits .placeholder i { animation: breathe 2.4s ease-in-out infinite; }
.code-digits .placeholder i:nth-child(2) { animation-delay: 0.15s; }
.code-digits .placeholder i:nth-child(3) { animation-delay: 0.3s; }
.code-digits .placeholder i:nth-child(4) { animation-delay: 0.45s; }
.code-digits .placeholder i:nth-child(5) { animation-delay: 0.6s; }
.code-digits .placeholder i:nth-child(6) { animation-delay: 0.75s; }

.code-meta {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.code-meta b { font-weight: 400; color: var(--ink-2); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: border-color 0.2s, background-color 0.2s, transform 0.12s var(--ease), opacity 0.2s;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.32); background-color: rgba(255, 255, 255, 0.04); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.btn-solid {
  min-width: 84px;
  height: 44px;
  border-color: transparent;
  background: var(--ink);
  color: #000;
  box-shadow: none;
}
.btn-solid:hover { background: #fff; border-color: transparent; }
.btn-solid.is-done { background: var(--signal); }
.btn.is-busy svg { animation: spin 0.8s linear infinite; }
.btn-backup[hidden] { display: none; }
.btn-backup { animation: fade-in 0.5s var(--ease) both; }

:focus-visible { outline: 1.5px solid var(--signal); outline-offset: 2px; }
.finder input:focus-visible { outline: none; }

/* ---- 工具栏 ---- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.toolbar .status { flex: 1; min-width: 0; margin: 0; }

/* 自动读取剩余时间：一条会缩短的细线 */
.track { height: 1px; margin: 14px 0 18px; background: var(--line); overflow: hidden; }
.track span { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, 0.5); transform-origin: left; }
.status { min-height: 20px; font-size: 12.5px; color: var(--ink-3); }
.status.is-error { color: var(--danger); }

/* ---- 邮件卡片 ---- */
.mails { display: flex; flex-direction: column; gap: 10px; }
.mail {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #0a0a0a, #060606);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 28px -14px rgba(255, 255, 255, 0.06);
  transition: border-color 0.25s, transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.mail:hover { border-color: rgba(255, 255, 255, 0.16); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 16px 34px -16px rgba(255, 255, 255, 0.1); }
.mail.is-open { border-color: rgba(255, 255, 255, 0.2); transform: none; }
.mail.is-enter { animation: slide-in 0.55s var(--ease) both; }
.mail[hidden] { display: none; }

.mail-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.mail-from { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-subject { grid-column: 1; font-size: 15px; font-weight: 400; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-code {
  grid-column: 2;
  justify-self: end;
  align-self: center;
  padding: 2px 9px;
  border: 1px solid rgba(200, 212, 255, 0.25);
  border-radius: 6px;
  font: 400 13px/1.5 var(--mono);
  color: var(--signal);
  letter-spacing: 0.06em;
}
.mail-new { width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--signal); display: inline-block; vertical-align: middle; }

.mail-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease); }
.mail.is-open .mail-body { grid-template-rows: 1fr; }
.mail-body-inner { overflow: hidden; }
.mail-body-pad { padding: 0 18px 18px; }
.mail-frame {
  display: block;
  width: 100%;
  height: 240px;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
}
.mail-body-msg { padding: 14px 0 4px; font-size: 13px; color: var(--ink-3); }
.mail-body-msg.is-error { color: var(--danger); }

.empty {
  padding: 44px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
}
.more {
  display: block;
  margin: 16px auto 0;
  padding: 8px 14px;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
}
.more:hover { color: var(--ink); }
.more[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(16, 16, 16, 0.92);
  backdrop-filter: blur(8px);
  font-size: 13px;
  color: var(--ink);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@keyframes cell-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .shell { padding: 32px 16px 80px; }
  .code-panel { padding: 20px 16px 16px; }
  .code-main { flex-direction: column; align-items: stretch; gap: 16px; }
  .code-digits { gap: 6px; flex-wrap: nowrap; }
  .code-digits .cell, .code-digits .placeholder i { width: auto; flex: 1; max-width: 48px; height: 54px; font-size: 26px; }
  .code-digits .placeholder { flex: 1; gap: 6px; }
  .btn-solid { width: 100%; }
  .finder-box { height: 52px; padding-left: 18px; }
  .finder input { font-size: 15px; }
  .finder-go { height: 40px; padding: 0 18px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .status { flex-basis: 100%; }
  .toolbar .btn { flex: 1; }
  .mail-head { padding: 14px; }
  .mail-body-pad { padding: 0 12px 12px; }
}

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