:root {
  --bg: #060913;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.085);
  --border: rgba(255, 255, 255, 0.11);
  --text: #eef2ff;
  --muted: #97a3c2;
  --accent: #6d5efc;
  --accent-soft: rgba(109, 94, 252, 0.16);
  --danger: #ff7a90;
  --ok: #5eead4;
  --warn: #fbbf24;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1100px 620px at 20% -10%, #151d3a 0%, #070b17 58%, #04060d 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
}

.aurora::before {
  width: 520px;
  height: 520px;
  top: -220px;
  left: -120px;
  background: radial-gradient(circle, rgba(109, 94, 252, 0.95), transparent 68%);
}

.aurora::after {
  width: 560px;
  height: 560px;
  right: -160px;
  bottom: -260px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.8), transparent 68%);
}

a { color: #c7c1ff; }

/* ------------------------------ 通用控件 ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #7c6cff, #4f46e5 55%, #0ea5e9);
  color: #fff;
  box-shadow: 0 14px 30px -16px rgba(79, 70, 229, 0.95);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: #d7dcf0;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.btn-ghost.danger { color: #ffb3c0; border-color: rgba(255, 122, 144, 0.35); }
.btn-ghost.danger:hover { background: rgba(255, 122, 144, 0.15); }

.btn-danger {
  background: linear-gradient(135deg, #ff6b81, #e11d48);
  color: #fff;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 9px;
}

.btn-block { width: 100%; height: 46px; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"] {
  width: 100%;
  height: 42px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(6, 10, 22, 0.75);
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder { color: rgba(151, 163, 194, 0.6); }

input:focus {
  outline: none;
  border-color: rgba(109, 94, 252, 0.9);
  box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field > label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }

.input-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.input-row > input { flex: 1; min-width: 160px; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cfd6ea;
  cursor: pointer;
  user-select: none;
}

.switch input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.muted { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.ta-right { text-align: right; }

/* ------------------------------ 登录 ------------------------------ */

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 30px 26px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(16px);
}

.login-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, #7c6cff, #0ea5e9);
  margin-bottom: 16px;
}

.login-card h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.01em; }
.login-card > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.login-card > .login-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12.5px;
  text-align: center;
}

.back-link {
  display: block;
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
}

.back-link:hover { color: #fff; }

/* ------------------------------ 顶栏 / 布局 ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 23, 0.82);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-dot {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, #7c6cff, #0ea5e9);
  box-shadow: 0 10px 24px -12px rgba(79, 70, 229, 1);
}

.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11.5px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ------------------------------ 统计 ------------------------------ */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}

.stat span { display: block; color: var(--muted); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.stat strong { display: block; margin-top: 8px; font-size: 26px; letter-spacing: -0.02em; }
.stat.is-accent strong { color: #b7b0ff; }
.stat small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

/* ------------------------------ 面板 / 表格 ------------------------------ */

.panel {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panel-head h2 { margin: 0 0 4px; font-size: 15.5px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.toolbar input { flex: 1; min-width: 200px; max-width: 340px; }

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}

.table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }

.code-cell {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: #fff;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.code-cell:hover { color: #b7b0ff; }

.link-cell {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #9fb0d8;
  text-decoration: none;
}

.link-cell:hover { color: #fff; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill.ok { color: var(--ok); background: rgba(94, 234, 212, 0.1); border-color: rgba(94, 234, 212, 0.28); }
.pill.off { color: #a7b0c8; background: rgba(167, 176, 200, 0.1); border-color: rgba(167, 176, 200, 0.24); }
.pill.warn { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.28); }
.pill.err { color: var(--danger); background: rgba(255, 122, 144, 0.1); border-color: rgba(255, 122, 144, 0.3); }

.usage { font-family: var(--mono); font-size: 12.5px; }
.usage small { color: var(--muted); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ------------------------------ 兑换链接分组 ------------------------------ */

.group-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 20px 20px;
}

.group-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 16px 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
}

.group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.group-title { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.group-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.group-link {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #a9b8e6;
  text-decoration: none;
  word-break: break-all;
  line-height: 1.55;
}

.group-link:hover { color: #fff; text-decoration: underline; }

.code-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}

.code-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid rgba(109, 94, 252, 0.28);
  background: rgba(109, 94, 252, 0.1);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.code-chip:hover { background: rgba(109, 94, 252, 0.22); border-color: rgba(109, 94, 252, 0.5); }
.code-chip:active { transform: scale(0.98); }
.code-chip strong { font-family: var(--mono); letter-spacing: 0.08em; }
.code-chip small { color: var(--muted); font-family: var(--mono); }
.code-chip.is-exhausted { opacity: 0.55; }

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(6, 10, 22, 0.75);
  color: var(--text);
  padding: 12px 14px;
  font-size: 13.5px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  line-height: 1.7;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea::placeholder { color: rgba(151, 163, 194, 0.6); }
textarea:focus {
  outline: none;
  border-color: rgba(109, 94, 252, 0.9);
  box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.2);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}


/* ------------------------------ 弹窗 ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 15, 0.72);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal.is-open .modal-backdrop { opacity: 1; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(165deg, #161c34 0%, #0a0f1f 65%);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal.is-open .modal-card { opacity: 1; transform: none; }

.modal-card h2 { margin: 0 0 14px; font-size: 18px; }
.modal-card > .muted { margin: 0 0 16px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.confirm-card { max-width: 400px; }

.form-error {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12.5px;
}

.result-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(109, 94, 252, 0.3);
  background: rgba(109, 94, 252, 0.1);
}

.test-code {
  flex: 1;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #fff;
  word-break: break-all;
}

.modal-card-wide { max-width: 660px; }

.result-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(109, 94, 252, 0.28);
  background: rgba(109, 94, 252, 0.09);
}

.result-line > .muted {
  flex: 0 0 120px;
  margin: 0;
  font-size: 12px;
}

.test-code-sm {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  word-break: break-all;
  line-height: 1.55;
}

.test-link { font-weight: 500; color: #c8d4ff; }

/* ------------------------------ 设置 / 其它 ------------------------------ */

.settings-form { padding: 18px 20px 22px; }
.settings-form .field { max-width: 520px; }
.settings-form .btn { margin-top: 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 80;
  transform: translate(-50%, 18px);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(16, 22, 40, 0.96);
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: #d9fff7;
  font-size: 13px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(255, 122, 144, 0.45); color: #ffd9e0; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .topbar { padding: 12px 16px; }
  .topbar-actions .btn { height: 34px; padding: 0 12px; font-size: 12.5px; }
  .container { padding: 18px 14px 48px; }
  .panel-head { padding: 16px 16px 12px; }
  .toolbar { padding: 12px 16px; }
  .group-list { padding: 4px 14px 16px; }
  .group-card { padding: 14px; }
  .group-head .row-actions { justify-content: flex-start; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-card { padding: 20px 18px; border-radius: 18px; }
  .result-line { flex-wrap: wrap; }
  .result-line > .muted { flex-basis: 100%; }
}

