/* Look of the code shop. Buyer pages sit on a flowing aurora (aurora.js) with
   frosted panels; the admin console uses the same tokens on a calm ground. */
:root {
  color-scheme: dark;
  --bg: #060912;
  --panel: rgba(13, 18, 40, .74);
  --panel-2: rgba(22, 30, 62, .8);
  --line: rgba(148, 170, 255, .16);
  --line-2: rgba(148, 170, 255, .3);
  --fg: #f2f5ff;
  --mut: #b6c0de;
  --dim: #7f8bb0;
  --cyan: #5ee7ff;
  --blue: #4a63f5;
  --violet: #a36bff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #ff9a9a;
  --grad: linear-gradient(100deg, #5ee7ff, #6a82ff 45%, #a36bff 90%);
  --cta: linear-gradient(110deg, #4a63f5, #8b5cf6);
  --sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--fg); font: 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased;
  background: radial-gradient(80% 60% at 50% -10%, #1a2a7a 0%, #0c1238 45%, var(--bg) 100%) fixed;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
[hidden] { display: none !important; }

.aurora { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s; pointer-events: none; }
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 24px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: rgba(6, 9, 18, .62); backdrop-filter: blur(16px); }
.top .wrap { display: flex; align-items: center; gap: 20px; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand svg { width: 38px; height: 30px; filter: drop-shadow(0 0 10px rgba(124, 92, 255, .6)); }
.top nav { display: flex; gap: 6px; margin-left: auto; }
.top nav a { padding: 8px 16px; border-radius: 999px; font-size: 15px; color: var(--mut); transition: background .2s, color .2s; }
.top nav a:hover { color: var(--fg); background: rgba(255, 255, 255, .07); }
.top nav a[aria-current] { color: var(--fg); background: rgba(255, 255, 255, .1); }

/* ---------- type ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 600; letter-spacing: .08em; color: var(--cyan); }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: pulse 1.6s ease-in-out infinite; }
.title { margin-top: 20px; font-size: clamp(32px, 5vw, 54px); font-weight: 900; line-height: 1.18; letter-spacing: -.02em; text-wrap: balance; }
.grad { background: var(--grad); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: slide 5s linear infinite alternate; }
.lead { margin-top: 14px; max-width: 36em; font-size: 18px; color: var(--mut); }
.hero { padding-block: 60px 34px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 26px; padding: 0; list-style: none; font-size: 15px; color: var(--mut); }
.flow li { display: flex; align-items: center; gap: 10px; }
.flow b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--cta); font-size: 13px; color: #fff; }
.flow li + li::before { content: "→"; margin-right: 4px; color: var(--dim); }
.label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--dim); }
.muted { color: var(--mut); }
.small { font-size: 13.5px; line-height: 1.6; color: var(--dim); }
.h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }

/* ---------- panels & controls ---------- */
.panel { position: relative; border-radius: 24px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(18px); box-shadow: 0 24px 60px -34px rgba(0, 0, 0, .8); }
.pad { padding: 28px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 26px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); font-weight: 700; white-space: nowrap; cursor: pointer; transition: transform .2s, border-color .2s, background .2s, box-shadow .3s; }
.btn:hover { transform: translateY(-2px); border-color: var(--cyan); background: rgba(255, 255, 255, .09); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { border-color: transparent; color: #fff; background: var(--cta); box-shadow: 0 12px 34px -12px #5b5bf6; }
.btn.primary:hover { box-shadow: 0 16px 40px -10px #6a6bff; }
.btn.sm { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.btn.block { width: 100%; }
.input { width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(4, 7, 18, .7); outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(94, 231, 255, .12); }
.input::placeholder { color: var(--dim); }
textarea.input { min-height: 220px; resize: vertical; font: 14px/1.7 var(--mono); }
.msg { padding: 12px 16px; border-radius: 14px; border: 1px solid; font-size: 14.5px; font-weight: 600; }
.msg.bad { color: var(--bad); border-color: rgba(255, 154, 154, .34); background: rgba(255, 154, 154, .09); }
.msg.ok { color: var(--ok); border-color: rgba(74, 222, 128, .34); background: rgba(74, 222, 128, .1); }
.msg.info { color: var(--warn); border-color: rgba(251, 191, 36, .34); background: rgba(251, 191, 36, .09); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--mut); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); border-color: rgba(74, 222, 128, .4); background: rgba(74, 222, 128, .08); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); }
.pill.info { color: var(--cyan); border-color: rgba(94, 231, 255, .4); background: rgba(94, 231, 255, .08); }

/* ---------- shop ---------- */
.shop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 28px; align-items: start; padding-bottom: 90px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tile { display: flex; flex-direction: column; gap: 14px; padding: 26px; text-align: left; cursor: pointer; transition: transform .25s, border-color .25s, box-shadow .3s, background .25s; }
.tile:hover { transform: translateY(-4px); border-color: var(--line-2); background: var(--panel-2); }
.tile[aria-pressed="true"] { border-color: var(--cyan); background: var(--panel-2); box-shadow: 0 0 0 1px var(--cyan), 0 24px 60px -30px var(--cyan); }
.tile:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.tile .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; font-weight: 600; color: var(--mut); }
.tile .bonus { padding: 3px 10px; border-radius: 999px; background: linear-gradient(110deg, #f59e0b, #f97316); font-size: 12.5px; font-weight: 700; color: #1a1205; }
.tile .price { font-size: 52px; font-weight: 900; line-height: 1; letter-spacing: -.03em; }
.tile .price small { margin-right: 4px; font-size: 24px; font-weight: 700; color: var(--mut); }
.tile .gets { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(94, 231, 255, .08); border: 1px solid rgba(94, 231, 255, .18); font-size: 14px; color: var(--mut); }
.tile .gets b { font-size: 20px; color: var(--cyan); }
.checkout { position: sticky; top: 92px; }
.checkout .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sum { padding: 16px 18px; border-radius: 16px; background: rgba(4, 7, 18, .55); border: 1px solid var(--line); }
.sum .row + .row { margin-top: 10px; }
.sum .name { font-weight: 700; }
.qty { display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 14px; background: rgba(4, 7, 18, .7); border: 1px solid var(--line-2); }
.qty button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); font-size: 18px; font-weight: 700; cursor: pointer; transition: background .2s; }
.qty button:hover { background: var(--blue); }
.qty output { min-width: 36px; text-align: center; font-weight: 800; }
.total { font-size: 46px; font-weight: 900; line-height: 1.1; letter-spacing: -.03em; }

/* ---------- order / query ---------- */
.narrow { max-width: 680px; margin-inline: auto; padding-block: 60px 90px; }
.codes { display: flex; flex-direction: column; gap: 12px; }
.code { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; border-radius: 16px; border: 1px solid rgba(94, 231, 255, .4); background: rgba(94, 231, 255, .08); }
.code code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 600 16px var(--mono); color: var(--cyan); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 12px 20px; font-size: 15px; }
.facts dt { color: var(--dim); }
.facts dd { text-align: right; overflow-wrap: anywhere; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--cyan); animation: spin 1s linear infinite; }

/* ---------- admin console ---------- */
body.admin { background: linear-gradient(180deg, #0b1030, var(--bg) 420px) fixed; }
.console { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 6px; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(6, 9, 18, .6); }
.side .brand { flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 12px 18px; font-size: 16px; line-height: 1.4; }
.side .brand small { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; color: var(--cyan); }
.side a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--mut); transition: background .2s, color .2s; }
.side a.nav:hover { color: var(--fg); background: rgba(255, 255, 255, .06); }
.side a.nav[aria-current] { color: #fff; background: var(--cta); box-shadow: 0 10px 26px -14px #5b5bf6; }
.side a.nav svg { width: 18px; height: 18px; flex: none; }
.side .badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--warn); font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; color: #1a1205; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.main { min-width: 0; padding: 34px clamp(20px, 4vw, 48px) 80px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 26px; }
.page-head h1 { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.page-head p { margin-top: 4px; color: var(--mut); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.stat { padding: 22px; }
.stat .k { font-size: 14px; color: var(--mut); }
.stat .v { margin-top: 6px; font-size: 34px; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.stat .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 13.5px; color: var(--dim); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { padding: 14px 18px; text-align: left; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: var(--dim); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .03); }
td.num, th.num { text-align: right; }
td.mono { font: 13.5px var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(4, 7, 18, .6); font-size: 14px; font-weight: 600; color: var(--mut); cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.chip:hover { color: var(--fg); }
.chip[aria-pressed="true"] { border-color: var(--cyan); color: var(--fg); background: rgba(94, 231, 255, .12); }
.login { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login .panel { width: 100%; max-width: 440px; }

@keyframes pulse { 50% { opacity: .4; } }
@keyframes slide { to { background-position: -220% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .shop { grid-template-columns: minmax(0, 1fr); }
  .checkout { position: static; }
  .console { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; flex-direction: row; align-items: center; height: auto; padding: 12px 16px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { padding: 0 10px 0 0; white-space: nowrap; }
  .side .brand small { display: none; }
  .side a.nav { white-space: nowrap; }
  .side .foot { margin: 0 0 0 auto; flex-direction: row; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .top nav a { padding: 8px 10px; font-size: 14px; }
  .top .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
