:root {
  --bg: #0b0e0c;
  --panel: #101511;
  --amber: #ffb000;
  --amber-dim: rgba(255, 176, 0, 0.55);
  --green: #57e88b;
  --red: #ff5f56;
  --text: #cfe3d2;
  --dim: #5d6f60;
  --dark: #3d4a40;
  --line: #1f2b22;
  --mono: "JetBrains Mono", "Noto Sans SC", "SF Mono", Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--mono);
  background:
    radial-gradient(900px 380px at 50% -10%, rgba(87, 232, 139, 0.06), transparent 60%),
    radial-gradient(700px 300px at 90% 110%, rgba(255, 176, 0, 0.04), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 60px;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  z-index: 2;
}

.wrap { width: 100%; max-width: 720px; position: relative; z-index: 1; }

/* ---------- 顶栏 ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 38px 0 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 11px;
  letter-spacing: 0.2em;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
}

.live.on {
  color: var(--green);
  border-color: rgba(87, 232, 139, 0.4);
}

.live.on i {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink 1.4s infinite;
}

.live.dead {
  color: var(--red);
  border-color: rgba(255, 95, 86, 0.4);
}

.live.dead i { background: var(--red); }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.brand { font-weight: 800; letter-spacing: 0.12em; color: #e8f5ea; font-size: 15px; }

.freq { margin-left: auto; color: var(--dim); font-size: 11.5px; letter-spacing: 0.08em; }

/* ---------- 输入区 ---------- */
.hint { color: var(--dim); font-size: 12.5px; margin-top: 24px; line-height: 1.8; }

.prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 15px 18px;
  margin-top: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prompt-row:focus-within {
  border-color: rgba(87, 232, 139, 0.5);
  box-shadow: 0 0 0 3px rgba(87, 232, 139, 0.08);
}

.prompt-row .p { color: var(--green); font-weight: 700; flex-shrink: 0; }

.prompt-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #e8f5ea;
  font-family: inherit;
  font-size: 15px;
}

.prompt-row input::placeholder { color: var(--dark); }

.prompt-row button {
  flex-shrink: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.15em;
  background: var(--green);
  color: #06130b;
  border: none;
  border-radius: 4px;
  padding: 9px 22px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.prompt-row button:hover { filter: brightness(1.1); }
.prompt-row button:active { transform: translateY(1px); }
.prompt-row button:disabled { opacity: 0.5; cursor: wait; }

/* ---------- 日志 ---------- */
.log {
  margin-top: 14px;
  font-size: 12px;
  color: var(--dim);
  line-height: 1.9;
  min-height: 22px;
}

.log div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: logIn 0.25s ease both;
}

@keyframes logIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.log .t { color: var(--dark); }
.log .ok { color: var(--green); }
.log .err { color: var(--red); }

/* ---------- 信号卡 ---------- */
.result { margin-top: 24px; animation: rise 0.35s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.signal {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px 30px 22px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.signal.has-code {
  border-color: rgba(255, 176, 0, 0.35);
  box-shadow: 0 0 40px rgba(255, 176, 0, 0.07), inset 0 0 60px rgba(255, 176, 0, 0.03);
}

.corner { position: absolute; width: 14px; height: 14px; border: 2px solid var(--dim); transition: border-color 0.3s ease; }
.signal.has-code .corner { border-color: var(--amber); }
.corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; border-radius: 6px 0 0 0; }
.corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; border-radius: 0 6px 0 0; }
.corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; border-radius: 0 0 0 6px; }
.corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; border-radius: 0 0 6px 0; }

.s-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--dim);
  transition: color 0.3s ease;
}

.signal.has-code .s-head { color: var(--amber-dim); }

.code {
  font-weight: 800;
  font-size: clamp(52px, 11vw, 84px);
  letter-spacing: 0.24em;
  text-align: center;
  padding: 20px 0 6px;
  user-select: all;
  color: var(--dark);
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.signal.has-code .code {
  color: var(--amber);
  text-shadow: 0 0 18px rgba(255, 176, 0, 0.45), 0 0 60px rgba(255, 176, 0, 0.2);
}

.s-meta { text-align: center; font-size: 12px; color: var(--dim); min-height: 16px; }

.s-actions { text-align: center; margin-top: 16px; }

.s-actions button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 9px 28px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.s-actions button:hover:not(:disabled) { background: rgba(255, 176, 0, 0.12); }
.s-actions button:disabled { opacity: 0.3; cursor: not-allowed; }
.s-actions button.copied { background: var(--green); border-color: var(--green); color: #06130b; }

.wave {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 22px;
  margin-top: 20px;
  justify-content: center;
}

.wave i {
  width: 3px;
  height: 5px;
  background: rgba(87, 232, 139, 0.5);
  border-radius: 2px;
  animation: w 1.1s ease-in-out infinite;
}

.wave i:nth-child(2n) { animation-delay: 0.15s; }
.wave i:nth-child(3n) { animation-delay: 0.3s; }
.wave i:nth-child(4n) { animation-delay: 0.45s; }
.wave i:nth-child(5n) { animation-delay: 0.6s; }

@keyframes w { 0%, 100% { height: 5px; } 50% { height: 20px; } }

.wave.halted i { animation: none; background: var(--dark); }

/* ---------- 邮箱行 ---------- */
.mailbox-line {
  margin-top: 22px;
  font-size: 12px;
  color: var(--dim);
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.mailbox-line .rx {
  color: var(--green);
  border: 1px solid rgba(87, 232, 139, 0.4);
  border-radius: 3px;
  padding: 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
}

.mailbox-line.expired .rx { color: var(--red); border-color: rgba(255, 95, 86, 0.4); }

.mailbox-line .exp { margin-left: auto; color: var(--dark); }

/* ---------- 邮件列表 ---------- */
.list-title {
  margin-top: 28px;
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  font-weight: 500;
}

.mail-list { list-style: none; font-size: 13px; }

.mail-list li {
  display: flex;
  gap: 14px;
  padding: 11px 2px;
  border-bottom: 1px solid #141b15;
  align-items: baseline;
  animation: rise 0.3s ease both;
}

.mail-list .t { color: var(--dark); font-size: 11.5px; flex-shrink: 0; }

.mail-list .s {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.mail-list .f { color: var(--dark); font-size: 11px; flex-shrink: 0; display: none; }

.mail-list .tag {
  margin-left: auto;
  color: var(--amber);
  border: 1px solid rgba(255, 176, 0, 0.5);
  border-radius: 3px;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.list-empty { padding: 16px 2px; font-size: 12px; color: var(--dark); }

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 52px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--dark);
  letter-spacing: 0.1em;
  flex-wrap: wrap;
}

/* ---------- 动效编排 ---------- */
.top, .hint, .prompt-row, .foot {
  opacity: 0;
  animation: rise 0.55s cubic-bezier(0.22, 0.9, 0.32, 1) forwards;
}

.hint { animation-delay: 0.12s; }
.prompt-row { animation-delay: 0.24s; }
.foot { animation-delay: 0.42s; }

/* 待命灯慢脉冲 */
.live:not(.on):not(.dead) i { animation: standbyPulse 2.4s ease-in-out infinite; }

@keyframes standbyPulse {
  0%, 100% { opacity: 0.3; box-shadow: none; }
  50% { opacity: 1; box-shadow: 0 0 7px var(--dim); }
}

/* 终端光标 */
.prompt-row .p::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 6px;
  background: var(--green);
  vertical-align: -2px;
  animation: caret 1.05s steps(1) infinite;
}

@keyframes caret { 50% { opacity: 0; } }

/* 按钮呼吸光 */
.prompt-row button:not(:disabled) { animation: btnGlow 2.6s ease-in-out infinite; }

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(87, 232, 139, 0); }
  50% { box-shadow: 0 0 16px rgba(87, 232, 139, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  .top { flex-wrap: wrap; row-gap: 10px; }
  .freq { width: 100%; margin-left: 0; }
  .prompt-row { flex-wrap: wrap; }
  .prompt-row input { flex-basis: calc(100% - 40px); }
  .prompt-row button { width: 100%; padding: 12px; }
  .code { letter-spacing: 0.16em; }
  .mailbox-line .exp { margin-left: 0; width: 100%; }
  .mail-list .f { display: none; }
}
