:root {
  --ink: #1c1c1e;
  --muted: #8a8a8e;
  --line: #e2e2e7;
  --bg: #fafafa;
  --card: #ffffff;
  --accent: #0a7aff;
  --danger: #d3372f;
  --ok: #1d8a4e;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- public QR page ---------- */
.qr-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.bg-img {
  position: absolute;
  inset: -6%;
  background: url("/assets/bg-xianjian.jpg") center / cover no-repeat;
  animation: bg-breathe 26s ease-in-out infinite alternate;
}

@keyframes bg-breathe {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.12) translate3d(1.5%, -1.5%, 0); }
}

#embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bg-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.22) 45%, rgba(0, 0, 0, 0.68) 100%);
}

.qr-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}

.qr-card {
  padding: clamp(12px, 3vmin, 22px);
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(255, 200, 90, 0.55),
    0 0 46px rgba(255, 150, 40, 0.45),
    0 24px 60px -30px #000;
}

#qr {
  display: block;
  width: min(72vmin, 420px);
  height: min(72vmin, 420px);
  object-fit: contain;
  image-rendering: pixelated;
}

.qr-empty {
  margin: 0;
  padding: 48px 40px;
  border: 2px dashed rgba(255, 200, 90, 0.5);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.45);
  color: #f4d9a4;
  font-size: 17px;
  line-height: 1.9;
  text-align: center;
}

.qr-empty span { font-size: 13px; color: rgba(244, 217, 164, 0.7); }

@media (prefers-reduced-motion: reduce) {
  .bg-img { animation: none; }
}

/* ---------- admin page ---------- */
.admin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 12px 32px -24px rgba(0, 0, 0, 0.4);
}

.card h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.card .hint {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }

input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 15px;
}

input[type="password"]:focus,
input[type="file"]:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  width: 100%;
  margin-top: 14px;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

button:hover { background: #000; }
button:disabled { opacity: 0.5; cursor: default; }

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.secondary:hover { background: var(--bg); color: var(--ink); }

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

.panel-preview {
  display: grid;
  place-items: center;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.panel-preview img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  image-rendering: pixelated;
}

.panel-preview .none { color: var(--muted); font-size: 13px; padding: 32px 0; }

input[type="file"] {
  width: 100%;
  font-size: 13px;
  color: var(--muted);
}

[hidden] { display: none !important; }
