:root {
  --bg: #0c0f16;
  --panel: #111827;
  --card: #151c2b;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #7c3aed;
  --accent-2: #14b8a6;
  --border: #1f2937;
  --success: #22c55e;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 30% 10%, #1a2233 0, #0c0f16 60%);
  color: var(--text);
  line-height: 1.65;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 18px 80px;
}
header.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background: linear-gradient(120deg, rgba(124,58,237,0.18), rgba(20,184,166,0.16));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}
.hero h1 { margin: 0; font-size: 28px; letter-spacing: 0.3px; }
.hero p { margin: 0; color: var(--muted); }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
button.primary, button.secondary, button.ghost-btn {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
button.primary { background: linear-gradient(135deg, #7c3aed, #22c55e); }
button.secondary { background: #1f2937; border: 1px solid #243349; color: var(--text); }
button.ghost-btn { background: transparent; border: 1px dashed #334155; color: var(--text); }
button.ghost { background: transparent; border: 1px dashed #334155; color: var(--text); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,0.22); }

.progress {
  margin-top: 12px;
  background: #0f1624;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar {
  flex: 1;
  height: 10px;
  background: #1f2937;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22c55e, #7c3aed);
  border-radius: inherit;
  transition: width 0.3s ease;
}

#rewardBadge {
  font-size: 14px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.card.collected { border-color: #22c55e44; box-shadow: 0 12px 30px rgba(34,197,94,0.14); }
.card h3 { margin: 6px 0 6px; }
.card p { margin: 4px 0; color: var(--muted); }
.card .hint { color: #fbbf24; }
.card .fact { color: #c4b5fd; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); font-size: 12px; margin: 0; }
.pill { padding: 6px 10px; border-radius: 999px; font-size: 12px; border: 1px solid #334155; color: var(--muted); }
.pill-good { border-color: #22c55e88; color: #bbf7d0; }
.pill-neutral { border-color: #475569; }

#arPane {
  margin-top: 18px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 14px;
  justify-items: center;
  align-items: center;
  scroll-margin-top: 96px;
}
#arPane.lite { border-color: #f59e0b55; box-shadow: 0 10px 30px rgba(245,158,11,0.14); }
#cameraFrame {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 12px;
  overflow: hidden;
  background: #0b1220;
  border: 1px solid #1f2937;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
#cameraFrame.ar-active {
  background: transparent;
}
#cameraFeed {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b1220;
}
/* Ensure any canvases or additional renderers cover the same area */
#cameraFrame canvas, #cameraFrame video, #cameraFrame .three-canvas {
  position: absolute !important;
  left: 0; top: 0; right: 0; bottom: 0;
  width: 100% !important; height: 100% !important;
}
#cameraFrame video { z-index: 0 !important; }
#cameraFrame canvas, #cameraFrame .three-canvas { z-index: 1; }
.upload-preview {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reticle {
  position: absolute;
  left: 50%; top: 50%;
  width: 160px; height: 160px;
  margin-left: -80px; margin-top: -80px;
  border: 2px solid rgba(124,58,237,0.6);
  border-radius: 18px;
  box-shadow: 0 0 22px rgba(124,58,237,0.45), inset 0 0 10px rgba(20,184,166,0.3);
  animation: pulse 1.8s infinite;
  z-index: 2;
}

/* Scanning animation inside the reticle */
.reticle {
  position: absolute;
  left: 50%; top: 50%;
  width: 160px; height: 160px;
  margin-left: -80px; margin-top: -80px;
  border: 2px solid rgba(124,58,237,0.6);
  border-radius: 18px;
  box-shadow: 0 0 28px rgba(124,58,237,0.45), inset 0 0 14px rgba(20,184,166,0.28);
  overflow: hidden;
}
.reticle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(124,58,237,0.05), rgba(20,184,166,0.03));
  pointer-events: none;
}
.reticle .scanline {
  position: absolute;
  left: 50%; width: 80%; height: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.95), rgba(255,255,255,0));
  transform: translateX(-50%);
  top: 10%;
  animation: scanMoveAlt 2s ease-in-out infinite alternate;
  mix-blend-mode: screen;
  filter: blur(3px);
  box-shadow: 0 0 18px rgba(255,255,255,0.65);
  border-radius: 4px;
}
@keyframes scanMoveAlt {
  0% { top: 8%; opacity: 0; }
  20% { opacity: 0.85; }
  50% { top: 50%; opacity: 0.95; }
  80% { opacity: 0.6; }
  100% { top: 92%; opacity: 0; }
}
@keyframes pulse { 0% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.03); opacity: 0.6; } 100% { transform: scale(1); opacity: 0.9; } }

#statusText { color: var(--muted); font-size: 14px; margin: 0; text-align: center; }

.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #0f172a;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}
.toast.warn { border-color: #f59e0b88; color: #fbbf24; }
.toast.success { border-color: #22c55e88; color: #bbf7d0; }

#liteBadge {
  display: inline-block;
  padding: 6px 10px;
  background: rgba(245,158,11,0.1);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.4);
  border-radius: 10px;
}

.share-box {
  margin-top: 12px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.share-box textarea {
  width: 100%;
  min-height: 80px;
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  font-size: 14px;
}

.footer-note { color: var(--muted); font-size: 13px; margin-top: 12px; }

#fireworksCanvas {
  width: 100%;
  height: 260px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.06), rgba(12,15,22,0.95));
}

@media (min-width: 900px) {
  header.hero { grid-template-columns: 1.1fr 0.9fr; align-items: center; }
  /* Use three columns: left flexible, center fixed (camera), right flexible */
  #arPane { grid-template-columns: 1fr minmax(360px, 560px) 1fr; align-items: start; }
}

/* Place camera column into the right-side grid cell on wide screens */
@media (min-width: 900px) {
  /* place the camera column in the center column, other content moves to the right */
  #arPane > div:first-child { grid-column: 2; }
  #arPane > div:nth-child(2) { grid-column: 3; }
}

/* 顶部 LOGO */
.site-logo {
  position: fixed;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}
.site-logo {
  position: fixed;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
  padding: 8px 12px;
  background: rgba(255,255,255,0.12); /* brighter semi-opaque block */
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(124,58,237,0.12), 0 6px 22px rgba(0,0,0,0.6) inset;
  border: 1px solid rgba(255,255,255,0.16);
  position: relative;
}
.site-logo img { height: 120px; width: auto; display: block; max-height: 120px; filter: drop-shadow(0 10px 36px rgba(124,58,237,0.6)) saturate(1.12) contrast(1.05); }
.site-logo img { background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); padding: 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.04); }

/* stronger glow using pseudo element */
.site-logo::after {
  content: '';
  position: absolute;
  left: -6px; right: -6px; top: -6px; bottom: -6px;
  border-radius: 16px;
  background: radial-gradient(closest-side, rgba(124,58,237,0.14), rgba(20,184,166,0.06), transparent 60%);
  filter: blur(8px);
  z-index: -1;
}
@media (max-width: 640px) {
  main {
    padding-top: 8px;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    padding-left: 14px;
    padding-right: 14px;
  }
  header.hero { padding: 14px; }
  .actions { gap: 8px; }
  .actions button, .actions select { flex: 1 1 100%; width: 100%; }
  .progress { flex-wrap: wrap; gap: 8px; }
  .progress-bar { flex: 1 1 100%; }
  #rewardBadge { font-size: 13px; line-height: 1.4; }
  #cameraFrame { max-height: 70vh; }
  #fireworksCanvas { height: 220px; }
  .site-logo {
    position: relative;
    top: auto;
    left: auto;
    margin: calc(8px + env(safe-area-inset-top)) 0 8px 10px;
    padding: 6px 10px;
  }
  .site-logo img { height: 80px; max-height: 80px; }
}

/* 让捕捉区域与按钮更居中自然 */
#arPane .actions { justify-content: center; }

/* Prize modal */
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,6,23,0.7); }
.modal-panel { position: relative; z-index: 61; width: min(520px, 92%); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: 0 24px 60px rgba(0,0,0,0.6); text-align: center; }
.modal-close { position: absolute; right: 12px; top: 8px; background: transparent; border: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.qr-wrap { margin: 12px auto; width: 220px; height: 220px; display: grid; place-items: center; background: #071123; border-radius: 12px; border: 1px solid #12202b; }
.qr-wrap img { max-width: 88%; max-height: 88%; display: block; }

@media (prefers-reduced-motion: reduce) {
  .reticle, .reticle .scanline { animation: none; }
  button.primary, button.secondary, button.ghost-btn { transition: none; }
}
