:root {
  --primary: #7b1fa2;
  --primary-dark: #4a148c;
  --bg-grape: #f1f3f5;
  --line-grape: #cfd8dc;
  --coupon-bg: #ff6f00;
  --lock-bg: #546e7a;
  --white: #ffffff;
  --text-main: #333333;
}

body {
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 600px;
  background-color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
  position: relative;
  min-height: 100vh;
  box-sizing: border-box; /* 패딩 포함 크기 계산 */
}

/* 숨김 처리를 위한 유틸리티 클래스 */
.container.hidden {
    display: none !important;
}

h1 {
  font-size: 2.5rem;
  color: var(--primary-dark);
  margin: 0 0 10px 0;
  font-weight: 800;
  letter-spacing: -1px;
}

.subtitle {
  font-size: 1.1rem;
  color: #555;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 30px;
}
.subtitle span { color: var(--primary); font-weight: 800; }

/* 포도송이 컨테이너 */
.grape-bunch-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
}

.grape-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

/* 빈 포도알 (기본) */
.grape {
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  font-size: 1.2rem; font-weight: bold; color: var(--line-grape);
  background-color: var(--bg-grape);
  border: 2px dashed var(--line-grape);
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer; /* 클릭 가능 표시 */
}

/* [중요] 채워진 포도알 (WebP 이미지 적용) */
.grape.filled {
  background: url('../images/grape-filled.webp') no-repeat center center;
  background-size: contain;
  
  /* 기존 스타일 덮어쓰기 */
  background-color: transparent;
  border: none;
  color: transparent; /* 숫자 숨김 */
  
  transform: scale(1.1);
  box-shadow: none; /* 이미지 자체 그림자 사용 */
}

/* CSS 체크표시 제거 (이미지 사용하므로) */
.grape.filled::after {
  display: none;
}

/* 뱃지 */
.badge {
  position: absolute; bottom: -10px;
  color: #fff; font-size: 0.7rem; padding: 2px 8px;
  border-radius: 10px; font-weight: bold;
  z-index: 5; white-space: nowrap;
  text-shadow: none; /* 텍스트 그림자 제거 */
}
.badge.coupon { background: var(--coupon-bg); }
.badge.lock { background: var(--lock-bg); }

/* 하단 상태 박스 */
.status-box {
  width: 100%;
  background-color: #f8f9fa;
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  margin-bottom: 30px;
  box-sizing: border-box;
}
.status-count { font-size: 3rem; color: var(--primary-dark); font-weight: 900; }

/* 리워드 인포 박스 */
.reward-info-box {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.reward-step {
    flex: 1;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.reward-step.active { border: 2px solid var(--primary); background: #f3e5f5; }
.reward-step h3 { margin: 10px 0 5px 0; font-size: 1rem; color: #333; }
.reward-step p { margin: 0; font-size: 0.9rem; color: #666; word-break: keep-all; }
.reward-step .icon { font-size: 1.5rem; }

/* CTA 버튼 */
.cta-button {
    display: block;
    width: 100%;
    padding: 20px;
    background: var(--primary-dark);
    color: white;
    border-radius: 16px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    box-sizing: border-box;
    cursor: pointer;
    border: none; /* 버튼 태그용 초기화 */
}

/* 로딩 오버레이 */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.95);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999; font-weight: bold; color: var(--primary);
  opacity: 1; transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }

/* 토스트 메시지 스타일 */
#toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 16px 30px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

#toast-container.show {
    opacity: 1;
}

/* 모바일 대응 */
@media (max-width: 360px) {
    .grape {
        width: 45px; height: 45px;
        font-size: 1rem;
    }
    .grape-row {
        gap: 5px;
    }
    h1 {
        font-size: 2rem;
    }
}
