:root {
  --bg: #08090d;
  --text: #eef3f8;
  --muted: #93a0b4;
  --line: rgba(255, 255, 255, 0.08);
  --cyan: #5eead4;
  --amber: #fbbf24;
  --rose: #fb7185;
  --ok: #4ade80;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(94, 234, 212, 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(251, 191, 36, 0.1), transparent 50%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 0%, #000 20%, transparent 75%);
}
button, input, select { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 2px solid rgba(94, 234, 212, 0.85); outline-offset: 2px; }
a { color: var(--cyan); text-decoration: none; }

.glass {
  background: rgba(14, 16, 24, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
}

.user-app, .admin-shell { position: relative; z-index: 1; min-height: 100vh; }
.topbar {
  width: min(1080px, calc(100% - 28px));
  margin: 18px auto 0;
  padding: 14px 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-weight: 700; letter-spacing: 0.04em;
  background: linear-gradient(160deg, rgba(94, 234, 212, 0.95), rgba(45, 212, 191, 0.55));
  color: #06221e;
  flex: none;
}
.brand h1 { margin: 0; font-size: 16px; font-weight: 650; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.timer {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 8px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.timer span { color: var(--muted); font-size: 12px; }
.timer strong {
  font-family: var(--mono); font-size: 28px; letter-spacing: 0.04em; font-weight: 650;
}
.timer.soon strong { color: var(--amber); }
.timer.late { border-color: rgba(251, 113, 133, 0.45); }
.timer.late strong { color: var(--rose); }
.redeem-bar {
  display: flex; gap: 10px; align-items: center;
  padding: 12px; border-radius: 22px; margin-bottom: 16px;
}
.redeem-bar input {
  flex: 1; min-width: 0; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28); padding: 12px 14px; outline: none;
}
.redeem-bar input:focus { border-color: rgba(94, 234, 212, 0.65); }
.redeem-bar .btn { flex: none; min-width: 112px; }
.id-card.open { box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 1px rgba(94, 234, 212, 0.18); }
.id-card.hot { box-shadow: var(--shadow), 0 0 0 1px rgba(251, 191, 36, 0.55); }
.lock-pill, .open-pill {
  border-radius: 999px; padding: 3px 8px; font-size: 12px; border: 1px solid var(--line); color: var(--muted);
}
.open-pill { color: #9af6e8; border-color: rgba(94, 234, 212, 0.35); background: rgba(94, 234, 212, 0.08); }
.mask-bar {
  display: inline-flex; align-items: center; min-width: 120px; height: 28px; padding: 0 12px;
  border-radius: 999px; letter-spacing: 0.22em; color: transparent; user-select: none; pointer-events: none;
  background: rgba(255, 255, 255, 0.06);
  text-shadow: 0 0 8px rgba(238, 243, 248, 0.72);
}
.otp.locked-otp { justify-content: flex-start; background: rgba(255,255,255,0.03); }
.btn.lit { box-shadow: 0 8px 24px rgba(45, 212, 191, 0.22); }
.alert-copy { margin: 0 0 14px; line-height: 1.6; font-size: 16px; }
.guide {
  border-radius: 22px; padding: 0; margin-bottom: 16px; overflow: hidden;
  border-color: rgba(94, 234, 212, 0.38);
  background:
    linear-gradient(100deg, rgba(94, 234, 212, 0.16), rgba(251, 191, 36, 0.1) 58%, rgba(14, 16, 24, 0.2)),
    rgba(14, 16, 24, 0.72);
}
.guide-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border: 0; background: transparent; text-align: left;
}
.guide-icon {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none;
  color: #06221e;
  background: linear-gradient(160deg, #8ff3e4, #2dd4bf);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.12);
}
.guide-title {
  font-size: 20px; font-weight: 800; letter-spacing: 0.01em; line-height: 1.2;
  background: linear-gradient(90deg, #8ff3e4 0%, #5eead4 42%, #fbbf24 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.guide-badge {
  margin-left: auto; flex: none; border-radius: 999px; padding: 3px 8px;
  font-size: 12px; font-weight: 700; color: #3b2503;
  background: linear-gradient(180deg, #fde68a, #fbbf24);
}
.guide-chevron {
  flex: none; color: #fbbf24;
  transition: transform 0.28s ease;
}
.guide.open .guide-chevron { transform: rotate(180deg); }
.guide-panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s ease;
}
.guide.open .guide-panel { grid-template-rows: 1fr; }
.guide-panel-inner { overflow: hidden; min-height: 0; }
.guide-lead { margin: 0 16px; color: var(--muted); line-height: 1.6; }
.guide-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 16px 0; }
.sample { border-radius: 16px; padding: 14px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); }
.sample strong { display: block; margin: 8px 0 4px; }
.sample p { margin: 0; line-height: 1.55; }
.sample em { display: block; margin-top: 8px; font-style: normal; color: #fecdd3; font-size: 13px; }
.sample-tag { display: inline-flex; border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.sample.ok { box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.35); }
.sample.ok .sample-tag { background: rgba(74, 222, 128, 0.14); color: #86efac; }
.sample.bad { box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.4); }
.sample.bad .sample-tag { background: rgba(251, 113, 133, 0.14); color: #fda4af; }
.guide-fix { margin: 14px 16px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) {
  .guide-panel, .guide-chevron, .risk-fold svg { transition: none; }
  .risk-ico { animation: none; }
}
.guide-fix h3 { margin: 0 0 8px; font-size: 15px; }
.guide-fix ol { margin: 0; padding-left: 18px; line-height: 1.7; }
.guide-fix p { margin: 10px 0 0; color: var(--muted); line-height: 1.6; }

.user-main {
  width: min(1080px, calc(100% - 28px));
  margin: 22px auto 40px;
}
.user-main.center { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.redeem { width: min(460px, 100%); padding: 28px 24px; border-radius: 22px; }
.redeem h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.03em; }
.redeem .lead { margin: 0 0 18px; color: var(--muted); line-height: 1.6; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.field input, .inline input, .search {
  width: 100%; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28); padding: 12px 14px; outline: none;
}
.field input:focus, .inline input:focus, .search:focus { border-color: rgba(94, 234, 212, 0.65); }
.btn {
  border: 0; border-radius: 12px; padding: 12px 14px; background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}
.btn.primary {
  background: linear-gradient(180deg, #8ff3e4, #2dd4bf); color: #06221e; font-weight: 700; border-color: transparent;
}
.btn.danger { background: rgba(251, 113, 133, 0.12); color: #fecdd3; border-color: rgba(251, 113, 133, 0.28); }
.btn.small { padding: 7px 10px; border-radius: 10px; font-size: 13px; }
.banner {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 12px;
  background: rgba(94, 234, 212, 0.08); color: #d5fff6; line-height: 1.5;
}
.banner.danger { background: rgba(251, 113, 133, 0.12); color: #ffe4e8; }
.risk-banner {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 12px;
  border-radius: 16px; color: #fff7e6;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: linear-gradient(105deg, rgba(120, 53, 15, 0.72), rgba(127, 29, 29, 0.55));
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.14);
}
.risk-banner p { margin: 0; flex: 1; min-width: 0; line-height: 1.55; font-size: 14px; }
.risk-banner strong { color: #fde68a; font-weight: 800; }
.risk-banner.folded p {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.risk-ico {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center; color: #fbbf24;
  animation: risk-pulse 1.4s ease-in-out infinite;
}
.risk-fold {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: #fde68a;
}
.risk-fold svg { transition: transform 0.28s ease; }
.risk-banner.folded .risk-fold svg { transform: rotate(180deg); }
.risk-modal { z-index: 30; background: rgba(0, 0, 0, 0.72); }
.risk-card {
  width: min(440px, 100%); padding: 22px 20px 18px; border-radius: 22px; text-align: left;
  border-color: rgba(251, 191, 36, 0.5);
  background:
    radial-gradient(420px 160px at 50% 0%, rgba(251, 113, 133, 0.2), transparent 68%),
    rgba(12, 10, 8, 0.96);
}
.risk-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 12px;
  color: #3b2503;
  background: linear-gradient(160deg, #fde68a, #f59e0b);
  box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.12);
}
.risk-card h2 { margin: 0 0 10px; font-size: 20px; line-height: 1.35; font-weight: 800; }
.risk-card p { margin: 0; line-height: 1.7; font-size: 16px; }
.risk-card strong { color: #fde68a; font-weight: 800; }
.btn.warn {
  width: 100%; margin-top: 16px; padding: 14px 16px; font-size: 17px; font-weight: 800;
  background: linear-gradient(180deg, #fde68a, #f59e0b); color: #3b2503; border-color: transparent;
}
@keyframes risk-pulse {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 rgba(251, 191, 36, 0)); }
  50% { opacity: 0.65; filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.9)); }
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 420px)); gap: 16px; }
.id-card {
  position: relative; border-radius: 22px; padding: 18px 16px 16px; overflow: hidden;
  border-top: 2px solid hsl(var(--accent), 72%, 64%);
}
.card-head, .line, .tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h3 { margin: 0; font-size: 16px; }
.platform { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.line { padding: 10px 0; border-top: 1px solid var(--line); }
.line .k { color: var(--muted); font-size: 12px; width: 52px; flex: none; }
.line .v { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); }
.secret.masked { filter: blur(7px); user-select: none; }
.tools { flex-wrap: wrap; justify-content: flex-end; }
.otp {
  margin-top: 8px; padding: 12px; border-radius: 14px;
  background: rgba(94, 234, 212, 0.08); display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.otp b { font-family: var(--mono); font-size: 28px; letter-spacing: 0.18em; }
.otp.empty { color: var(--muted); background: rgba(255, 255, 255, 0.03); }
.warn {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px; line-height: 1.55; font-size: 13px;
  background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.28); color: #f8e7b2;
}
.hint { margin-top: 10px; color: var(--muted); font-size: 13px; }
.card-actions { margin-top: 12px; }
.card-actions .btn { width: 100%; }
.empty {
  padding: 28px; border-radius: 18px; color: var(--muted); text-align: center;
}
.leave { margin-top: 18px; background: none; border: 0; color: var(--muted); padding: 0; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 30; padding: 10px 14px; border-radius: 999px;
  background: #10141c; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); position: relative; z-index: 1; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.login { width: min(420px, 100%); padding: 28px 22px; border-radius: 22px; }
.login h2 { margin: 8px 0; }

.admin-shell { display: grid; grid-template-columns: 220px 1fr; }
.side {
  padding: 18px 14px; border-right: 1px solid var(--line);
  background: rgba(8, 9, 13, 0.45); position: sticky; top: 0; height: 100vh;
}
.side nav { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.navbtn { text-align: left; background: transparent; border: 0; border-radius: 12px; padding: 10px 12px; color: var(--muted); }
.navbtn.active { background: rgba(94, 234, 212, 0.12); color: var(--text); }
.side .quit { margin-top: 18px; width: 100%; }
.content { padding: 22px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 26px; }
.page-head p, .note { color: var(--muted); line-height: 1.6; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { padding: 14px; border-radius: 16px; }
.stat b { display: block; font-size: 26px; margin-top: 4px; }
.stat span { color: var(--muted); font-size: 12px; }
.panel { padding: 16px; border-radius: 18px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
.switch { display: flex; align-items: center; gap: 10px; color: var(--text); }
.switch input { width: 18px; height: 18px; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; }
.inline .field { flex: 1; min-width: 140px; }
.alert {
  padding: 10px 12px; border-radius: 12px; margin-bottom: 12px;
  background: rgba(251, 191, 36, 0.12); color: #f8e7b2;
}
.table-wrap { overflow-x: auto; border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.badge { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 12px; border: 1px solid var(--line); }
.badge.idle { color: var(--ok); }
.badge.busy { color: #7dd3fc; }
.badge.cool { color: var(--amber); }
.badge.off { color: var(--muted); }
.badge.unused { color: var(--cyan); }
.badge.active { color: #7dd3fc; }
.badge.expired, .badge.revoked { color: var(--rose); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border-radius: 999px; padding: 6px 10px; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip.on { color: #06221e; background: var(--cyan); border-color: transparent; }
.mono { font-family: var(--mono); }
.result { white-space: pre-wrap; word-break: break-all; background: rgba(0,0,0,.28); padding: 12px; border-radius: 12px; }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 18px; }
.modal-card { width: min(520px, 100%); padding: 18px; border-radius: 18px; max-height: min(90vh, 760px); overflow: auto; }
.modal-card h3 { margin: 0 0 12px; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 5; height: auto;
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand quit" "nav nav";
    align-items: center; column-gap: 8px; row-gap: 8px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow: hidden;
  }
  .side .brand { grid-area: brand; min-width: 0; }
  .side .brand h1, .side .brand p {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .side nav {
    grid-area: nav; flex-direction: row; flex-wrap: nowrap; align-items: center;
    gap: 6px; margin: 0; overflow-x: auto; scrollbar-width: none;
  }
  .side nav::-webkit-scrollbar { display: none; }
  .navbtn { flex: none; white-space: nowrap; padding: 8px 12px; }
  .side .quit { grid-area: quit; width: auto; margin: 0; white-space: nowrap; padding: 8px 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 14px 12px 28px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head h2 { font-size: 22px; }
  .page-head .btn { width: 100%; }
  .filters {
    flex-wrap: nowrap; overflow-x: auto; margin-right: -2px; padding-bottom: 2px;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; white-space: nowrap; }
  table { min-width: 0; width: 100%; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; box-sizing: border-box; }
  tr {
    margin: 0; padding: 8px 12px 10px;
    border-bottom: 1px solid var(--line);
  }
  tr:last-child { border-bottom: 0; }
  td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; border-bottom: 0; padding: 7px 2px; min-width: 0; font-size: 13px;
  }
  td::before { content: attr(data-label); color: var(--muted); flex: none; font-size: 12px; }
  .cell-value {
    flex: 1 1 0; min-width: 0; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
  }
  td:has(.actions) { flex-wrap: wrap; align-items: flex-start; padding-top: 8px; }
  td:has(.actions)::before { width: 100%; }
  .actions { display: flex; flex-wrap: nowrap; gap: 8px; width: 100%; }
  .actions .btn.small {
    flex: 1 1 0; min-width: 0; margin: 0; padding: 8px 4px;
    font-size: 12px; white-space: nowrap; text-align: center;
  }
  .table-wrap { border: 1px solid var(--line); overflow: hidden; }
}
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .timer { justify-content: space-between; }
  .timer strong { font-size: 24px; }
  .redeem h2 { font-size: 24px; }
  .cards { grid-template-columns: 1fr; }
  .redeem-bar { flex-direction: column; align-items: stretch; }
  .redeem-bar .btn { width: 100%; }
  .guide-compare { grid-template-columns: 1fr; }
  .gen-form { flex-direction: column; align-items: stretch; }
  .gen-form .field, .gen-form .btn { width: 100%; min-width: 0; flex: none; }
}
