:root {
  --bg0: #0f1412;
  --bg1: #161c19;
  --panel: rgba(255, 252, 247, 0.045);
  --line: rgba(232, 224, 210, 0.12);
  --text: #f4efe6;
  --muted: #a39a8c;
  --accent: #c4a574;
  --accent-2: #7d9b84;
  --wechat: #07c160;
  --alipay: #1677ff;
  --douyin: #fe2c55;
  --radius: 18px;
  --font: "DM Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --display: "Instrument Serif", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #243028 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 0%, #3a2f22 0%, transparent 50%), var(--bg0);
  color: var(--text);
  font-family: var(--font);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 75%);
  opacity: 0.55;
}

.top {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand .mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #e8d5b5, #8f7350);
  box-shadow: 0 8px 24px rgba(196, 165, 116, 0.28);
}

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.ghost {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.ghost:hover {
  color: var(--text);
  border-color: rgba(232, 224, 210, 0.28);
}

.ghost.tiny {
  padding: 4px 10px;
  font-size: 12px;
}

.auth-slot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.primary-btn,
button[type="submit"] {
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #e8d5b5, #b8935f);
  color: #1b1610;
  font-weight: 650;
  cursor: pointer;
  font: inherit;
  width: 100%;
}

.primary-btn:disabled,
button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: wait;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.modal[hidden],
[hidden] {
  display: none !important;
}

.pay-modal {
  align-items: center;
}

.pay-sheet {
  width: min(100%, 420px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, #151c28, #0e131c);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.pay-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pay-sheet__head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.pay-sheet__body {
  padding: 18px 18px 20px;
  text-align: center;
}

.pay-instr {
  margin: 0;
  font-size: 14px;
  color: #d7dde8;
}

.pay-countdown {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #3fd0c9;
}

.pay-wait {
  margin: 8px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #3fd0c9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pay-qr-wrap {
  margin: 16px auto 0;
  width: min(100%, 260px);
  aspect-ratio: 1;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: grid;
  place-items: center;
}

.pay-qr {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pay-qr-fallback {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: #333;
  font-size: 12px;
  line-height: 1.4;
  padding: 12px;
}

.pay-qr-fallback img {
  width: 36px;
  height: 36px;
}

.pay-qr-fallback strong {
  color: #fe2c55;
  font-size: 14px;
}

.pay-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.pay-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 10px;
}

.pay-btn {
  border-radius: 12px;
  padding: 12px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pay-btn.primary {
  border: 0;
  color: #041716;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
}

.pay-btn.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pay-btn.ghost {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #e8eef8;
}

@media (max-width: 560px) {
  .pay-actions {
    grid-template-columns: 1fr;
  }
}

.modal-card {
  position: relative;
  width: min(100%, 420px);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1a211d, #121714);
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.modal-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.form-err {
  margin: 0;
  color: #ff8f8f;
  font-size: 13px;
}

#login-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 24px 64px;
}

.hero {
  padding: 28px 0 18px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--accent);
  margin: 0 0 12px;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.05;
  margin: 0 0 16px;
}

.hero h1 em {
  font-style: italic;
  color: #e8d5b5;
}

.lead {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 15px;
  margin: 0;
}

.panel {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.hint {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.packs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pack {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  border-radius: 14px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

.pack:hover {
  transform: translateY(-1px);
  border-color: rgba(196, 165, 116, 0.45);
}

.pack.active {
  border-color: var(--accent);
  background: rgba(196, 165, 116, 0.12);
  box-shadow: inset 0 0 0 1px rgba(196, 165, 116, 0.25);
}

.pack .price {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pack .strike {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: line-through;
}

.pack .meta {
  color: var(--muted);
  font-size: 12px;
}

.pack .tag {
  margin-top: 8px;
  font-size: 11px;
  color: var(--accent);
}

.channel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.ch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
}

.ch img {
  width: 18px;
  height: 18px;
}

.ch.active {
  border-color: var(--accent);
  background: rgba(196, 165, 116, 0.12);
}

.qr-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
}

.qr-stage > img {
  width: min(100%, 220px);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

.empty-qr {
  width: min(100%, 220px);
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  color: #222;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
}

.empty-qr .dy-ico {
  width: 36px;
  height: 36px;
  margin: 0 auto 4px;
}

.empty-qr strong {
  color: var(--douyin);
  font-size: 14px;
}

#qr-caption {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.usage-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(125, 155, 132, 0.35);
  background: rgba(125, 155, 132, 0.1);
}

.usage-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.usage-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.usage-card .bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.usage-card .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7d9b84, #c4a574);
  border-radius: inherit;
  transition: width 0.35s ease;
}

#usage-detail {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text);
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pay-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
}

.pay-card header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.wechat {
  background: var(--wechat);
}
.dot.alipay {
  background: var(--alipay);
}
.dot.douyin {
  background: var(--douyin);
}

.pay-card img,
.qr-fallback {
  width: min(100%, 180px);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
  display: block;
}

.qr-fallback {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.qr-fallback img {
  width: 100%;
  height: 100%;
  margin: 0;
}

.empty-qr {
  display: grid;
  gap: 6px;
  padding: 16px;
  color: #222;
  font-size: 12px;
  line-height: 1.4;
}

.empty-qr strong {
  font-size: 14px;
  color: var(--douyin);
}

.pay-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.form-panel form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 12px 14px;
}

input:focus,
select:focus {
  outline: 1px solid rgba(196, 165, 116, 0.55);
  border-color: rgba(196, 165, 116, 0.55);
}

button[type="submit"] {
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #e8d5b5, #b8935f);
  color: #1b1610;
  font-weight: 650;
  cursor: pointer;
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: wait;
}

.result {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(125, 155, 132, 0.35);
  background: rgba(125, 155, 132, 0.12);
  font-size: 14px;
  line-height: 1.55;
}

.result.error {
  border-color: rgba(229, 72, 77, 0.4);
  background: rgba(229, 72, 77, 0.12);
}

.result code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 6px;
  border-radius: 6px;
}

.foot {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.foot code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 860px) {
  .packs,
  .pay-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .packs,
  .pay-grid {
    grid-template-columns: 1fr;
  }
}
