*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: #f2f2f7;
  color: #1c1c1e;
  min-height: 100dvh;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.container {
  max-width: 480px;
  margin: 0 auto;
}

.title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* ── 그리드 ── */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* ── 카드 ── */
.card {
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  transition: transform 0.12s ease;
  user-select: none;
}

.card:active {
  transform: scale(0.97);
}

/* 쿠폰 전체가 잘리지 않게 */
.card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fafafa;
}

/* ── 항상 보이는 다운로드 버튼 ── */
.overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 15px 0;
  background: #fff;
  border-top: 1px solid #e5e5ea;
}

.overlay span {
  font-size: 15px;
  font-weight: 600;
  color: #007aff;
}

/* ── 로딩 ── */
.card.loading .overlay span {
  color: #aeaeb2;
}

.card.loading .overlay span::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #e5e5ea;
  border-top-color: #007aff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 토스트 ── */
.toast {
  position: fixed;
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  max-width: calc(100vw - 48px);
  width: max-content;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
