:root {
  --bg: #0f172a;
  --bg-2: #111c33;
  --card: #ffffff;
  --ink: #1e293b;
  --ink-soft: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --ok: #16a34a;
  --warn: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #1e3a8a 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  color: #e2e8f0;
  margin-bottom: 26px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #93c5fd, #bfdbfe 40%, #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .sub {
  max-width: 720px;
  margin: 0 auto;
  font-size: 14.5px;
  color: #b6c2d9;
}
.hero code {
  background: rgba(148, 163, 184, 0.18);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.hidden { display: none !important; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

textarea#input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea#input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  background: #fff;
}
textarea#input::placeholder { color: #94a3b8; }

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.hint { font-size: 12px; color: #94a3b8; margin-left: auto; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s, background 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.btn.primary:hover { box-shadow: 0 8px 22px rgba(37, 99, 235, 0.45); }
.btn.ghost {
  color: var(--ink);
  background: #f1f5f9;
  border: 1.5px solid var(--line);
}
.btn.ghost:hover { background: #e9eef6; }

.error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #b91c1c;
  font-size: 13.5px;
}

/* ---------- Clock ---------- */
.clockbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.clock { display: flex; align-items: baseline; gap: 10px; }
.clock-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.clock-time {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: 1px;
}
.clock-hint { font-size: 12.5px; color: #94a3b8; max-width: 520px; }

/* ---------- Result table ---------- */
.result-head h2 {
  font-size: 17px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 2px 10px;
}

.table-scroll { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }

table.otp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 760px;
}
table.otp-table thead th {
  text-align: left;
  padding: 12px 12px;
  background: #f8fafc;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.otp-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.otp-table tbody tr:last-child td { border-bottom: none; }
table.otp-table tbody tr:hover { background: #f8fbff; }

.c-secret {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #334155;
  max-width: 220px;
}
.c-secret .secret {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.muted { color: #cbd5e1; }

.c-code { white-space: nowrap; }
.c-code .code {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ok);
  display: inline-block;
  min-width: 96px;
}
.c-code .code.invalid { color: var(--warn); letter-spacing: 0; }
.cd {
  font-size: 11.5px;
  color: #94a3b8;
  margin-left: 8px;
  font-family: var(--mono);
}
.cd.warn { color: var(--warn); font-weight: 700; }

.mini {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.mini:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Footer ---------- */
.foot { text-align: center; color: #7c8aa5; font-size: 12.5px; margin-top: 10px; }
.foot p { margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(14px);
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b91c1c; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .page { padding: 26px 14px 40px; }
  .hero h1 { font-size: 22px; }
  .card { padding: 16px; }
  .hint { display: none; }
}
