:root {
  --bg: #020617;
  --card: rgba(15, 23, 42, 0.92);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --brand: #8b5cf6;
  --brand-2: #22d3ee;
  --gold: #fbbf24;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.16), transparent 28%),
    linear-gradient(180deg, #020617 0%, #0b1020 48%, #111827 100%);
  color: var(--text);
  font-family: "Pretendard", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
a { color: #c4b5fd; }
button, input, textarea, select { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--brand);
  color: white;
  font-weight: 700;
}
button.secondary { background: #334155; }
button.ghost { background: transparent; border: 1px solid #475569; }
button.warning { background: var(--warning); color: #111827; }
button.danger { background: var(--danger); }
button.compact { min-height: 40px; padding: 8px 12px; font-size: 13px; }
button:disabled { opacity: 0.45; }
input, textarea, select {
  width: 100%;
  background: #0b1220;
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px 14px;
}
textarea { min-height: 120px; resize: vertical; }
.hidden { display: none !important; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
}
.topbar-actions { display: flex; gap: 8px; }
.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 24px;
}
.hero, .panel, .step-card, .result-card, .library-card, .admin-card, .overlay-card, .selected-state, .stamp-card, .capsule-card, .tower-card, .asset-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.hero, .panel, .step-card { padding: 18px; margin-bottom: 14px; }
.hero h1, .overlay-card h1, .step-card h2, .panel h2 { margin: 0 0 8px; }
.helper, .panel p.helper { margin-top: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.meta-chip-row, .button-row, .asset-grid, .result-list, .library-list, .admin-grid, .legal-links {
  display: grid;
  gap: 10px;
}
.button-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 10px 0; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.chip, .medal-chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.16);
  color: #fcd34d;
  font-size: 12px;
  font-weight: 800;
}
.result-card, .library-card, .admin-card { padding: 14px; }
.result-card strong, .library-card strong { display: block; margin-bottom: 4px; }
.result-card small, .library-card small { color: var(--muted); }
.status-banner {
  display: none;
  margin: 12px 16px 0;
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.4;
}
.status-banner.show { display: block; }
.status-info { background: rgba(34, 211, 238, 0.14); border: 1px solid rgba(34, 211, 238, 0.4); }
.status-error { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.4); }
.status-success { background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.4); }
.asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.asset-card { overflow: hidden; }
.asset-card img { width: 100%; height: 120px; object-fit: cover; background: #111827; }
.asset-card .body { padding: 12px; }
.asset-card .price { color: #fcd34d; font-weight: 700; }
.selected-state {
  padding: 12px;
  margin-bottom: 12px;
  color: #dbeafe;
  border-style: dashed;
  border-color: rgba(34, 211, 238, 0.45);
}
.empty-state {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.footer-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 20px; text-align: center; }
.stamp-board { margin-top: 12px; }
.stamp-card { padding: 16px; border-color: rgba(251, 191, 36, 0.35); background: radial-gradient(circle at top right, rgba(251, 191, 36, 0.16), rgba(15, 23, 42, 0.9)); }
.stamp-card .grade { letter-spacing: 2px; color: #fcd34d; font-weight: 800; font-size: 13px; }
.cert-success { border-color: rgba(16, 185, 129, 0.7); }
.cert-pending { border-color: rgba(245, 158, 11, 0.7); }
.cert-fail { border-color: rgba(239, 68, 68, 0.7); }
.capsule-card { margin-top: 10px; padding: 14px; border-color: rgba(139, 92, 246, 0.45); background: rgba(91, 33, 182, 0.18); }
.subhead { margin: 18px 0 8px; font-size: 15px; color: #c4b5fd; }
.tower-card { margin-top: 12px; padding: 16px; border-color: rgba(251, 191, 36, 0.35); }
.tower-stack { display: flex; flex-direction: column-reverse; gap: 4px; margin: 12px 0; max-width: 120px; }
.tower-floor {
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.82);
  display: grid;
  place-items: center;
  padding: 20px;
}
.overlay-card { max-width: 420px; padding: 24px; }
.onboard-list { padding-left: 18px; color: #dbeafe; line-height: 1.6; }
.consent-row { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; font-size: 13px; color: var(--muted); }
.consent-row input { width: auto; }
.consent-box { margin: 16px 0; border: 1px solid rgba(148, 163, 184, 0.25); border-radius: 12px; padding: 4px 12px; }
.consent-box .consent-row { margin: 10px 0; }
.consent-all { border-bottom: 1px solid rgba(148, 163, 184, 0.2); padding-bottom: 10px; color: #e2e8f0; }
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(2, 6, 23, 0.94);
  border-top: 1px solid var(--line);
}
.tab-btn {
  background: transparent;
  color: var(--muted);
  min-height: 48px;
  font-size: 13px;
}
.tab-btn.active { color: white; background: rgba(139, 92, 246, 0.28); }
.kakao-btn {
  width: 100%;
  background: #fee500;
  color: #191919;
  font-weight: 800;
}
.kakao-btn:hover { filter: brightness(0.97); }
  display: block;
  margin-top: 16px;
  text-align: center;
  background: var(--brand);
  color: white;
  text-decoration: none;
  border-radius: 14px;
  padding: 14px;
  font-weight: 700;
}
.share-shell, .legal-copy { max-width: 720px; margin: 0 auto; padding: 18px 16px 40px; }
.legal-copy p { line-height: 1.7; color: #dbeafe; }
.postcard-view h2 { margin: 10px 0; }
.legal-links { grid-template-columns: 1fr 1fr; margin: 12px 0 20px; }
.locked-card { border-style: dashed; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
@media (max-width: 640px) {
  .grid-two, .button-row, .asset-grid { grid-template-columns: 1fr; }
}

/* ---------- 게임화: 한정 엽서 · 사냥 · 도감 ---------- */
:root { --legend: #f5b942; --rare: #a78bfa; --common: #60a5fa; }
.tab-btn { padding: 8px 4px; }
.rarity { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
.rarity-legend { background: rgba(245, 185, 66, 0.18); color: var(--legend); border: 1px solid rgba(245, 185, 66, 0.5); }
.rarity-rare { background: rgba(167, 139, 250, 0.18); color: var(--rare); border: 1px solid rgba(167, 139, 250, 0.5); }
.rarity-common { background: rgba(96, 165, 250, 0.16); color: var(--common); border: 1px solid rgba(96, 165, 250, 0.45); }
.rarity-edge-legend { border-left: 4px solid var(--legend) !important; }
.rarity-edge-rare { border-left: 4px solid var(--rare) !important; }
.rarity-edge-common { border-left: 4px solid var(--common) !important; }
.hunt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.hunt-card small, .item-card small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.hunt-card.is-collected { opacity: 0.7; }
.region-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.region-card small { display: block; color: var(--muted); }
.ghost-link { display: inline-block; padding: 10px 14px; border: 1px solid #475569; border-radius: 14px; color: var(--text); text-decoration: none; font-weight: 700; text-align: center; }
.field-label { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip { min-height: 40px; padding: 8px 14px; border-radius: 999px; background: #1e293b; border: 1px solid #334155; color: var(--text); font-size: 14px; }
.chip small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.chip.active { background: rgba(139, 92, 246, 0.3); border-color: var(--brand); }
#editionPreview { margin: 12px 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item-card { padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.item-card strong { display: block; margin-top: 2px; }
.item-no { font-size: 12px; font-weight: 800; color: var(--text); }
.progress { height: 8px; border-radius: 999px; background: #1e293b; overflow: hidden; margin: 8px 0 2px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.is-complete { border-color: rgba(16, 185, 129, 0.6) !important; }
.mission-card strong { display: block; margin: 4px 0; }
.acquire-card { text-align: center; animation: acquire-pop 0.45s ease-out; }
.edition-no { font-size: 56px; font-weight: 900; line-height: 1; margin: 14px 0 4px; }
.edition-no span { font-size: 22px; color: var(--muted); font-weight: 700; }
.first-badge { display: inline-block; margin-top: 6px; padding: 4px 12px; border-radius: 999px; background: var(--gold); color: #111827; font-weight: 800; font-size: 13px; }
.rarity-glow-legend { box-shadow: 0 0 0 1px rgba(245, 185, 66, 0.6), 0 0 48px rgba(245, 185, 66, 0.35); }
.rarity-glow-rare { box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.6), 0 0 40px rgba(167, 139, 250, 0.3); }
.rarity-glow-common { box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.5), 0 0 32px rgba(96, 165, 250, 0.22); }
.reward-list { text-align: left; margin: 14px 0 0; padding-left: 18px; color: #dbeafe; line-height: 1.6; }
@keyframes acquire-pop { 0% { transform: scale(0.85); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .acquire-card { animation: none; } }
.overlay-card { width: 100%; max-height: calc(100vh - 40px); overflow-y: auto; }

.mini-actions { display: flex; gap: 16px; justify-content: flex-end; margin-top: 8px; }
.link-btn { width: auto; min-height: 0; padding: 4px 2px; background: none; border: none; box-shadow: none; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
