:root {
  --ink: #14132b;
  --ink-2: #1f1d3d;
  --ink-3: #2a2752;
  --gold: #d8b04a;
  --gold-soft: #f0dfa6;
  --paper: #f6efdd;
  --paper-2: #ede2c6;
  --seal: #b23a2e;
  --text-dim: #b9b6d6;

  --font-display: "Noto Serif KR", serif;
  --font-headline: "Black Han Sans", sans-serif;
  --font-hand: "Nanum Pen Script", cursive;
  --font-body: "Noto Sans KR", sans-serif;
  --font-pretendard: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  min-height: 100%;
  overflow-x: hidden;
}

.night-sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 8%, rgba(216,176,74,0.10), transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(216,176,74,0.06), transparent 45%),
    linear-gradient(180deg, #100e1c 0%, #16142a 55%, #17152b 100%);
  background-size: 140% 140%, 150% 150%, 100% 100%;
  animation: sky-drift 34s ease-in-out infinite alternate;
}

@keyframes sky-drift {
  from { background-position: 40% 0%, 100% 100%, 0 0; }
  to   { background-position: 55% 10%, 85% 85%, 0 0; }
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 64px 20px 24px;
}

.eyebrow {
  font-family: var(--font-hand);
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: 28px;
  color: var(--paper);
  transform: rotate(-1.5deg);
  margin: 0 0 6px;
}

.hero h1 {
  font-family: var(--font-headline);
  font-weight: 400;
  font-size: clamp(36px, 7vw, 60px);
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--paper);
}

.hero .sub {
  margin: 16px auto 0;
  max-width: 420px;
  color: var(--text-dim);
  line-height: 1.7;
  font-size: 15px;
  font-family: var(--font-pretendard);
}

.hero-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 26px auto 0;
  max-width: 220px;
}
.hero-divider .divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}
.hero-divider .divider-dot {
  color: var(--gold);
  font-size: 13px;
  line-height: 1;
}

/* ---------- Tray ---------- */
.tray {
  max-width: 640px;
  margin: 40px auto 8px;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}

.cookie {
  flex: 0 0 92px;
  width: 92px;
}

@media (max-width: 520px) {
  .tray { gap: 16px; }
  .cookie { flex-basis: calc(50% - 8px); width: calc(50% - 8px); max-width: 140px; }
}

.cookie {
  position: relative;
  aspect-ratio: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.cookie img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: hue-rotate(var(--cookie-hue, 0deg)) drop-shadow(0 6px 10px rgba(0,0,0,0.35));
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), filter 0.35s ease;
}

.cookie:hover img,
.cookie:focus-visible img {
  transform: translateY(-6px) rotate(-3deg) scale(1.05);
  filter: hue-rotate(var(--cookie-hue, 0deg)) drop-shadow(0 10px 16px rgba(216,176,74,0.4));
}

.cookie:active img { transform: scale(0.94); }

.cookie.drawn-today {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 16px;
}

.cookie:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}
.cookie:disabled img { transform: none !important; }

.cookie.cracking img {
  animation: crack 0.5s ease forwards;
}

@keyframes crack {
  0%   { transform: scale(1) rotate(0); }
  35%  { transform: scale(1.15) rotate(-8deg); }
  60%  { transform: scale(0.9) rotate(6deg); }
  100% { transform: scale(0.4) rotate(0); opacity: 0; }
}

.status-line {
  text-align: center;
  font-family: var(--font-pretendard);
  font-size: 13px;
  color: var(--text-dim);
  margin: 28px auto 0;
  min-height: 18px;
}

/* ⚠️ 테스트용 스타일입니다. 배포 전 이 블록과 index.html의 .dev-tools를 함께 삭제하세요. */

.btn-reset {
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  color: var(--seal);
  border: 1px dashed var(--seal);
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
}
.btn-reset:hover { background: rgba(178, 58, 46, 0.12); }

/* ---------- Result overlay / ticket ---------- */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 22, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  animation: fade-in 0.25s ease;
}

.result-overlay[hidden] {
  display: none !important;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.ticket {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 4px;
  padding: 40px 28px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: unfurl 0.45s cubic-bezier(.2,.9,.3,1.2);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(178,58,46,0.04) 28px);
}

@keyframes unfurl {
  from { transform: scaleY(0.3) translateY(20px); opacity: 0; }
  to   { transform: scaleY(1) translateY(0); opacity: 1; }
}

.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 10px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 12px);
}
.ticket::before { top: -5px; }
.ticket::after { bottom: -5px; }

.ticket-seal {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--seal);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}

.ticket-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--seal);
  margin: 10px 0 0;
}

.ticket-fortune {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.55;
  margin: 16px 0 10px;
}

.ticket-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8a8467;
  margin: 0;
}

.ticket-divider {
  height: 1px;
  background: repeating-linear-gradient(90deg, #cabf98 0 5px, transparent 5px 9px);
  margin: 20px 0 20px;
}

.ticket-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.98); }

.btn-kakao {
  background: #fee500;
  color: #391b1b;
}

.btn-ghost {
  background: var(--paper-2);
  color: var(--ink);
}

.btn-close {
  background: transparent;
  color: #8a8467;
  font-weight: 500;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 30px 20px 50px;
  font-size: 12px;
  color: #5f5c86;
}

@media (prefers-reduced-motion: reduce) {
  .cookie img, .ticket, .result-overlay, .night-sky { animation: none !important; transition: none !important; }
}