:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #101827;
  --panel-soft: #162033;
  --line: #293750;
  --text: #f7f9fd;
  --muted: #91a0b8;
  --accent: #8b7cff;
  --accent-bright: #b9afff;
  --success: #79e4b1;
  --danger: #ff9aab;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 82% -12%, rgba(99, 91, 255, .3) 0, transparent 37%),
    radial-gradient(circle at -10% 48%, rgba(29, 155, 240, .12) 0, transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

a { color: inherit; }
[hidden] { display: none !important; }

.shell { width: min(1080px, calc(100% - 40px)); margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 28px 0; border-bottom: 1px solid rgba(145, 160, 184, .18); }
.brand { font-size: 13px; font-weight: 800; letter-spacing: .16em; text-decoration: none; }
.brand span { color: var(--accent-bright); }
.text-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.text-link:hover { color: var(--text); }

.hero { max-width: 690px; padding: 88px 0 48px; }
.compact-hero { padding: 70px 0 34px; }
.eyebrow { margin: 0 0 14px; color: var(--accent-bright); font: 11px var(--mono); letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 20px; font-size: clamp(38px, 7vw, 76px); line-height: .98; letter-spacing: -.065em; }
h1 em { color: var(--accent-bright); font-style: normal; }
h2 { margin-bottom: 8px; font-size: 28px; letter-spacing: -.04em; }
.lede { max-width: 590px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.card-panel { border: 1px solid var(--line); border-radius: 20px; background: rgba(16, 24, 39, .88); box-shadow: 0 20px 70px rgba(0, 0, 0, .22); }
.redeem-panel { padding: 28px; }
.stack-form { display: grid; gap: 12px; }
label { color: var(--muted); font-size: 12px; font-weight: 700; }
input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 15px 16px; outline: none; background: #090f1b; color: var(--text); font: 500 14px var(--mono); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 124, 255, .16); }
.input-row { display: flex; gap: 12px; }
.input-row input { flex: 1; }
button { border: 0; border-radius: 10px; cursor: pointer; font-family: var(--sans); font-weight: 800; transition: transform .2s, opacity .2s, background .2s; }
button:hover { transform: translateY(-1px); }
button:disabled { cursor: wait; opacity: .55; transform: none; }
.primary-button { padding: 14px 20px; background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #0b0824; }
.ghost-button, .small-button { padding: 10px 13px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 12px; }
.small-button { padding: 7px 10px; }
.form-hint, .security-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.message { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: 13px; }
.message.success { color: var(--success); }

.result-section { padding: 88px 0 0; }
.result-head, .admin-heading, .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; }

.stripe-card { position: relative; width: min(100%, 680px); min-height: 380px; margin-top: 28px; overflow: hidden; padding: 36px; background: linear-gradient(145deg, #4b39c9 0%, #231c69 52%, #10162b 100%); }
.stripe-card::before { position: absolute; width: 360px; height: 360px; right: -120px; bottom: -210px; border: 70px solid rgba(255, 255, 255, .06); border-radius: 50%; content: ""; }
.stripe-card-top { position: relative; display: flex; justify-content: space-between; align-items: flex-start; }
.stripe-card-top small { display: block; margin-top: 2px; color: rgba(255, 255, 255, .6); font: 9px var(--mono); letter-spacing: .16em; }
.stripe-wordmark { font-size: 27px; font-weight: 800; letter-spacing: -.08em; }
.active-badge { padding: 7px 10px; border: 1px solid rgba(121, 228, 177, .4); border-radius: 999px; background: rgba(121, 228, 177, .08); color: var(--success); font: 9px var(--mono); letter-spacing: .12em; }
.card-number-field { margin-top: 85px; }
.card-bottom-grid { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 170px)); gap: 38px; margin-top: 36px; }
.field-label { display: block; margin-bottom: 7px; color: rgba(255, 255, 255, .58); font: 9px var(--mono); letter-spacing: .14em; }
.field-value-row { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.stripe-element { flex: 1; min-width: 90px; min-height: 28px; }
.card-number { min-width: 260px; }
.compact-value { width: 160px; }
.copy-shell { position: relative; width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 8px; background: rgba(255, 255, 255, .07); cursor: pointer; }
.copy-shell::before, .copy-shell::after { position: absolute; width: 9px; height: 10px; border: 1px solid rgba(255, 255, 255, .72); border-radius: 2px; content: ""; pointer-events: none; }
.copy-shell::before { top: 8px; left: 8px; }
.copy-shell::after { top: 11px; left: 11px; background: #302485; }
.copy-shell span { position: absolute; inset: 0; z-index: 2; }
.security-note { width: min(100%, 680px); margin-top: 14px; }

.footer { padding: 70px 0 34px; color: #53637d; font: 11px var(--mono); letter-spacing: .04em; }
.auth-form { width: min(420px, 100%); padding: 24px; }
.auth-form .primary-button { margin-top: 8px; }
.admin-shell { padding-bottom: 40px; }
.admin-heading { margin: 60px 0 26px; align-items: center; }
.admin-heading h1 { margin: 0; font-size: clamp(34px, 6vw, 56px); }
.generate-panel { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(360px, 1fr); align-items: end; gap: 36px; padding: 28px; }
.generate-copy { align-self: start; }
.generate-copy h2 { margin-bottom: 7px; }
.generate-controls { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px 14px; }
.generate-controls input { padding: 12px 13px; }
.generate-controls .primary-button { grid-column: 1 / -1; margin-top: 6px; }
.generated-result { margin-top: 14px; padding: 18px; border: 1px solid rgba(139, 124, 255, .45); border-radius: 14px; background: rgba(139, 124, 255, .08); }
.generated-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.generated-heading span { display: block; color: var(--muted); font-size: 11px; }
.generated-heading strong { display: block; margin-top: 4px; color: var(--accent-bright); font-size: 13px; }
.generated-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.generated-code-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 11px; border: 1px solid rgba(145, 160, 184, .16); border-radius: 10px; background: rgba(7, 11, 20, .5); }
.generated-code-row code { margin-right: auto; overflow-wrap: anywhere; color: var(--text); font: 12px var(--mono); }
.table-section { margin-top: 70px; }
.section-heading h2 { margin-bottom: 0; }
.table-wrap { margin-top: 20px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: rgba(16, 24, 39, .72); }
table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; }
th, td { padding: 15px 17px; border-bottom: 1px solid rgba(145, 160, 184, .12); text-align: left; white-space: nowrap; }
th { color: var(--muted); font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td:first-child { font: 500 12px var(--mono); }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); content: ""; }
.status-active { color: var(--success); }
.status-active::before { background: var(--success); }
.status-inactive, .status-expired, .status-canceled { color: var(--danger); }
.status-inactive::before, .status-expired::before, .status-canceled::before { background: var(--danger); }
.empty-state { margin: 0; padding: 34px; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1080px); }
  .hero { padding-top: 64px; }
  .input-row { align-items: stretch; flex-direction: column; }
  .input-row .primary-button { width: 100%; }
  .result-head, .admin-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .stripe-card { min-height: 350px; padding: 26px; }
  .card-number-field { margin-top: 70px; }
  .card-number { min-width: 190px; }
  .card-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .compact-value { width: 100%; }
  .generate-panel { grid-template-columns: 1fr; }
  .generate-controls { grid-template-columns: 1fr; }
  .generate-controls .primary-button { grid-column: auto; }
  .generated-codes { grid-template-columns: 1fr; }
  .footer { padding-top: 54px; }
}

@media (max-width: 440px) {
  .stripe-card { min-height: 380px; }
  .card-bottom-grid { grid-template-columns: 1fr; margin-top: 26px; }
  .card-number { min-width: 150px; }
  .generated-heading { align-items: flex-start; flex-direction: column; }
}
