:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--ink);
  min-height: 100vh;
}
.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 18px 60px;
}
.wrap.wide { max-width: 920px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  margin-bottom: 18px;
}
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 14px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; line-height: 1.5; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
button {
  cursor: pointer;
  border: none;
  background: var(--brand);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: background .15s;
}
button:hover { background: var(--brand-dark); }
form button[type=submit] { width: 100%; margin-top: 14px; }

/* 语言切换 */
.lang-switch { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 14px; }
.lang-btn {
  background: rgba(255,255,255,.14);
  color: #e2e8f0;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
}
.lang-btn:hover { background: rgba(255,255,255,.26); }
.lang-btn.active { background: #fff; color: var(--brand); }

/* 取码结果 */
.result { margin-top: 24px; text-align: center; }
.code {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  margin-bottom: 10px;
}
.meta { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 14px; }
.meta span { color: var(--muted); font-size: 13px; }
.copy { background: #eef2ff; color: var(--brand); padding: 7px 14px; font-size: 13px; }
.copy:hover { background: #e0e7ff; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); width: 100%; transition: width 1s linear; }

.error {
  margin-top: 18px;
  padding: 12px 14px;
  background: #fef2f2;
  color: var(--danger);
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
}
.hidden { display: none; }
.foot { text-align: center; color: rgba(226,232,240,.6); font-size: 12px; margin-top: 10px; }

/* 后台 */
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-head h1 { color: #fff; }
.ghost { background: rgba(255,255,255,.14); color: #e2e8f0; }
.ghost:hover { background: rgba(255,255,255,.26); }
.row-form { display: grid; grid-template-columns: 1.3fr 1.6fr .9fr auto; gap: 10px; align-items: center; }
.row-form button { width: auto; margin-top: 0; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 10px; line-height: 1.5; }
.sample { display: block; background: #f1f5f9; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; margin: 8px 0; color: #334155; word-break: break-all; }
textarea { resize: vertical; margin-bottom: 12px; }
#importBtn { width: auto; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.list-head h2 { margin: 0; }
.list-head input { max-width: 220px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.dim { color: var(--muted); font-size: 12.5px; }
.code-cell { white-space: nowrap; }
.mini-code { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.mini-sec { color: var(--muted); font-size: 12px; margin-left: 8px; }
.ops { white-space: nowrap; }
button.sm { padding: 6px 12px; font-size: 13px; margin-left: 6px; }
button.sm:first-child { margin-left: 0; }
button.danger { color: var(--danger); }
button.danger:hover { background: #fee2e2; }

@media (max-width: 680px) {
  .row-form { grid-template-columns: 1fr; }
  .tbl .dim { display: none; }
}
