﻿:root {
  --ink: #f5efe0;
  --muted: #a9a18e;
  --paper: #161411;
  --panel: rgba(31, 27, 21, 0.82);
  --panel-strong: #241f18;
  --line: rgba(245, 239, 224, 0.16);
  --accent: #ffb000;
  --accent-2: #5eead4;
  --danger: #ff6b6b;
  --ok: #8cffb3;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 176, 0, 0.22), transparent 31rem),
    radial-gradient(circle at 88% 18%, rgba(94, 234, 212, 0.13), transparent 28rem),
    linear-gradient(135deg, #100f0d 0%, #1a1712 48%, #0d1412 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image: linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 47px 47px;
  mask-image: radial-gradient(circle at center, #000, transparent 78%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 18px clamp(20px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 15, 13, 0.72);
  backdrop-filter: blur(18px);
}

.brand, nav { display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 800; letter-spacing: .04em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #111;
  background: var(--accent);
  border-radius: 11px 4px 11px 4px;
  box-shadow: 0 0 28px rgba(255, 176, 0, .25);
}
nav a, nav button {
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  padding: 9px 12px;
  border-radius: 999px;
}
nav button { color: var(--ink); }
.inline { display: inline; margin: 0; }

main { padding: clamp(24px, 5vw, 70px); }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .72fr);
  gap: clamp(26px, 5vw, 82px);
  align-items: center;
  max-width: 1180px;
  min-height: calc(100vh - 150px);
  margin: 0 auto;
}
.hero h1, .admin-title h1, .result-head h1, .panel h1, .panel h2 {
  margin: 0;
  line-height: .94;
  letter-spacing: -.06em;
}
.hero h1 { font-size: clamp(3.4rem, 9vw, 8.4rem); max-width: 860px; }
.lead { color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.35rem); line-height: 1.8; max-width: 660px; }
.eyebrow { color: var(--accent-2); font-size: .78rem; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; margin: 0 0 14px; }

.redeem-card, .panel {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(44, 37, 27, .92), rgba(24, 22, 18, .78));
  box-shadow: var(--shadow);
  border-radius: 30px;
  padding: clamp(24px, 4vw, 38px);
  overflow: hidden;
}
.redeem-card::before, .panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), transparent, var(--accent-2));
}
.redeem-card label, .panel label {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: .92rem;
  margin: 18px 0;
}
input, select, textarea {
  width: 100%;
  color: var(--ink);
  background: rgba(10, 9, 8, .72);
  border: 1px solid rgba(245, 239, 224, .19);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  transition: border .18s ease, box-shadow .18s ease, transform .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(255, 176, 0, .72);
  box-shadow: 0 0 0 4px rgba(255, 176, 0, .11);
}
input[type="file"] { padding: 12px; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  min-height: 46px;
  font-weight: 800;
}
.primary { color: #161411; background: var(--accent); box-shadow: 0 12px 30px rgba(255, 176, 0, .24); }
.ghost { color: var(--ink); background: rgba(255,255,255,.08); border: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
.hint { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.notice { border: 1px solid var(--line); border-radius: 15px; padding: 12px 14px; margin: 14px 0; line-height: 1.55; }
.notice.error { color: #ffe9e9; border-color: rgba(255,107,107,.4); background: rgba(255,107,107,.11); }
.notice.success { color: #ecfff1; border-color: rgba(140,255,179,.4); background: rgba(140,255,179,.10); }

.center-panel { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.login { width: min(460px, 100%); }
.login h1 { font-size: 3rem; margin-bottom: 18px; }

.admin-shell, .result-shell { max-width: 1260px; margin: 0 auto; display: grid; gap: 22px; }
.admin-title, .result-head, .section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
}
.admin-title h1, .result-head h1 { font-size: clamp(2.4rem, 5vw, 5.2rem); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(74px, 1fr)); gap: 10px; }
.stats div {
  min-width: 78px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255,255,255,.05);
}
.stats strong { display: block; font-size: 1.45rem; }
.stats span { color: var(--muted); font-size: .82rem; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.panel h2 { font-size: 2rem; margin-bottom: 12px; }
.wide { width: 100%; }
.success-panel { border-color: rgba(140,255,179,.32); }
.codes { min-height: 190px; font-family: "Cascadia Mono", "Consolas", monospace; letter-spacing: .08em; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--accent-2); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
td { color: #e4dccb; }
code, .json-view { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; }
code { color: #ffe0a1; }
.empty { color: var(--muted); text-align: center; }
.pill { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.pill.ready { color: #071f17; background: var(--accent-2); }
.pill.used { color: #2d1208; background: #ffb86b; }
.result-head { align-items: center; }
.json-view {
  margin: 0;
  padding: clamp(20px, 3vw, 34px);
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(5, 7, 8, .78);
  line-height: 1.65;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .hero, .grid.two { grid-template-columns: 1fr; }
  .admin-title, .result-head, .section-head { align-items: stretch; flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  main { padding: 22px; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
