/* mauthotp · 企业微信动态口令
 * 移动优先，深色玻璃质感；无外部依赖
 */

:root {
  --bg-0: #070b14;
  --bg-1: #0d1526;
  --bg-2: #111c31;
  --fg: #e8eefc;
  --fg-dim: #93a3bd;
  --fg-faint: #64748b;
  --line: rgba(148, 177, 219, 0.16);
  --card: rgba(20, 32, 53, 0.72);
  --brand: #3b82f6;
  --brand-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background:
    radial-gradient(1200px 620px at 50% -18%, rgba(59, 130, 246, 0.28), transparent 62%),
    radial-gradient(900px 520px at 88% 108%, rgba(34, 211, 238, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 58%, #05080f 100%);
}

/* 顶部 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #cfe0ff;
}

.brand svg { width: 22px; height: 22px; color: var(--brand-2); }

.icon-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-dim);
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.1); color: var(--fg); }

/* 主区域 */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 22px 40px;
}

.pane {
  display: none;
  width: 100%;
  max-width: 400px;
  flex-direction: column;
  align-items: center;
  animation: pane-in .32s ease both;
}

.pane.active { display: flex; }

@keyframes pane-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.pane-title {
  margin: 18px 0 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pane-sub {
  margin: 0;
  max-width: 320px;
  text-align: center;
  font-size: 13px;
  line-height: 1.75;
  color: var(--fg-dim);
}

.pane-sub b { color: var(--fg); font-weight: 600; }

.glyph {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: var(--brand-2);
  background: rgba(34, 211, 238, 0.09);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.glyph.danger { color: var(--danger); background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.22); }
.glyph svg { width: 38px; height: 38px; }

/* 用户条 */
.user {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
  color: #dbeafe;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.user-meta { flex: 1; min-width: 0; }

.user-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-sub { margin-top: 3px; font-size: 11.5px; color: var(--fg-faint); }

.chip {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.chip.ok   { color: var(--ok);   border-color: rgba(52, 211, 153, 0.3);  background: rgba(52, 211, 153, 0.1); }
.chip.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.3);  background: rgba(251, 191, 36, 0.1); }
.chip.bad  { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.1); }

/* 口令环 */
.dial {
  position: relative;
  width: min(78vw, 300px);
  aspect-ratio: 1 / 1;
  margin: 30px auto 6px;
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(148, 177, 219, 0.13);
  stroke-width: 6;
}

.ring-fg {
  fill: none;
  stroke: url(#none);
  stroke: var(--brand-2);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 578.05;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.45));
  transition: stroke-dashoffset .25s linear, stroke .3s;
}

.dial-inner {
  position: relative;
  width: 82%;
  text-align: center;
}

.otp {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(3px, 1.2vw, 6px);
  min-height: 54px;
}

.otp .digit {
  width: clamp(30px, 8.6vw, 40px);
  height: clamp(44px, 12.4vw, 56px);
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: clamp(24px, 7.4vw, 32px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color: #f2f7ff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 177, 219, 0.14);
  text-shadow: 0 0 18px rgba(120, 190, 255, 0.35);
}

.otp .digit.pop { animation: digit-pop .34s cubic-bezier(.22, 1.2, .4, 1) both; }
.otp .digit.pop:nth-child(2) { animation-delay: .03s; }
.otp .digit.pop:nth-child(3) { animation-delay: .06s; }
.otp .digit.pop:nth-child(4) { animation-delay: .09s; }
.otp .digit.pop:nth-child(5) { animation-delay: .12s; }
.otp .digit.pop:nth-child(6) { animation-delay: .15s; }

@keyframes digit-pop {
  from { opacity: 0; transform: translateY(7px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

.otp.copied .digit { background: rgba(34, 211, 238, 0.16); border-color: rgba(34, 211, 238, 0.4); }

.otp-hint {
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

/* 按钮 */
.btn {
  width: 100%;
  max-width: 300px;
  margin-top: 18px;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform .12s, filter .18s, background .18s, border-color .18s;
}

.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .55; pointer-events: none; }

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb 55%, #1d4ed8);
  box-shadow: 0 10px 26px -12px rgba(37, 99, 235, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn.primary:active { filter: brightness(1.06); }

.btn.ghost {
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.btn.ghost:active { background: rgba(255, 255, 255, 0.08); color: var(--fg); }

.foot-note {
  margin: 20px 0 0;
  font-size: 11.5px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
}

.err-hint {
  margin: 12px 0 0;
  padding: 10px 14px;
  max-width: 330px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
  white-space: pre-wrap;
}

/* 加载 */
.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(148, 177, 219, 0.18);
  border-top-color: var(--brand-2);
  animation: spin .85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  max-width: 84vw;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--fg);
  background: rgba(17, 28, 49, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 640px) {
  .dial { margin-top: 20px; width: min(64vw, 240px); }
  .pane-title { margin-top: 12px; }
}
