:root {
  color-scheme: light;
  --ink: #161a22;
  --muted: #697180;
  --line: #e5e7eb;
  --surface: #ffffff;
  --canvas: #f4f5f7;
  --navy: #111827;
  --navy-soft: #202a3a;
  --accent: #ffbd2e;
  --accent-strong: #f3a900;
  --danger: #d94841;
  /* 헤더 우주 테마 바탕색 */
  --space-base: #030310;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 10px 34px rgba(17, 24, 39, 0.08);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 95% -5%, rgba(255, 189, 46, 0.16), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.shell {
  width: min(100% - 32px, 820px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

/*
 * 헤더는 프로필 로고(우주 배경 + 성운 + 골드 텍스트)에 맞춘 우주 테마입니다.
 * 외부 이미지를 못 쓰므로(CSP img-src 'self') 성운과 별을 전부 그라데이션으로 그립니다.
 */
.site-header {
  position: relative;
  overflow: hidden;
  background-color: var(--space-base);
  /*
   * 크기를 px 로 고정합니다. % 로 주면 와이드 화면에서 성운이 헤더 전체로 퍼져
   * 갈색 안개처럼 번집니다. 위치만 % 로 두어 로고 근처를 따라가게 했습니다.
   */
  background-image:
    /* 로고 뒤 주황 헤일로 */
    radial-gradient(170px 105px at 20% 62%, rgba(255, 146, 24, 0.3), transparent 72%),
    /* 왼쪽 아래 마젠타 성운 */
    radial-gradient(420px 210px at 31% 142%, rgba(230, 45, 140, 0.34), transparent 72%),
    /* 오른쪽 위 보라 성운 */
    radial-gradient(440px 240px at 75% -42%, rgba(126, 66, 248, 0.36), transparent 72%),
    /* 오른쪽 시안 궤적 */
    radial-gradient(320px 170px at 95% 112%, rgba(42, 188, 250, 0.26), transparent 72%),
    linear-gradient(115deg, #030310 0%, #05051d 48%, #090524 100%);
  background-repeat: no-repeat;
  color: #ffffff;
  box-shadow: 0 8px 28px rgba(10, 6, 40, 0.45);
}

/* 헤더 아래 경계의 은은한 발광 (궤도 빛처럼) */
.site-header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 149, 0, 0.55) 18%,
    rgba(232, 62, 140, 0.65) 45%,
    rgba(56, 189, 248, 0.6) 72%,
    transparent
  );
  content: "";
}

.header-disclosure {
  padding: 9px 0 3px;
}

.header-disclosure p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(216, 223, 255, 0.72);
  font-size: 0.68rem;
  line-height: 1.45;
  letter-spacing: -0.025em;
}

.header-inner {
  position: relative;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 10px;
}

/* 별. 아주 작은 원 그라데이션을 흩뿌립니다. */
.header-inner::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  z-index: 0;
  background-image:
    radial-gradient(1.8px 1.8px at 6% 26%, #ffffff, transparent 100%),
    radial-gradient(1.3px 1.3px at 11% 72%, rgba(255, 255, 255, 0.85), transparent 100%),
    radial-gradient(1.6px 1.6px at 17% 18%, rgba(205, 228, 255, 0.95), transparent 100%),
    radial-gradient(1.1px 1.1px at 24% 54%, rgba(255, 255, 255, 0.7), transparent 100%),
    radial-gradient(2.1px 2.1px at 31% 84%, rgba(255, 228, 174, 0.95), transparent 100%),
    radial-gradient(1.2px 1.2px at 38% 30%, rgba(255, 255, 255, 0.78), transparent 100%),
    radial-gradient(1.5px 1.5px at 44% 66%, rgba(230, 212, 255, 0.9), transparent 100%),
    radial-gradient(1.1px 1.1px at 51% 12%, rgba(255, 255, 255, 0.72), transparent 100%),
    radial-gradient(2px 2px at 58% 46%, #ffffff, transparent 100%),
    radial-gradient(1.3px 1.3px at 64% 86%, rgba(190, 232, 253, 0.88), transparent 100%),
    radial-gradient(1.5px 1.5px at 71% 22%, rgba(255, 255, 255, 0.82), transparent 100%),
    radial-gradient(1.1px 1.1px at 77% 60%, rgba(255, 255, 255, 0.65), transparent 100%),
    radial-gradient(2.2px 2.2px at 84% 34%, rgba(255, 216, 168, 0.95), transparent 100%),
    radial-gradient(1.4px 1.4px at 89% 76%, rgba(255, 255, 255, 0.85), transparent 100%),
    radial-gradient(1.2px 1.2px at 94% 18%, rgba(216, 224, 255, 0.78), transparent 100%),
    radial-gradient(1.6px 1.6px at 98% 52%, rgba(255, 255, 255, 0.8), transparent 100%);
  background-repeat: no-repeat;
  content: "";
  transform: translateX(-50%);
  animation: twinkle 5.5s ease-in-out infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

.profile {
  min-width: 0;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
}

.profile-avatar {
  width: 70px;
  height: 58px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  /* 사각 로고가 우주 배경 위에 떠 보이도록 가장자리를 발광시킵니다. */
  border-radius: 12px;
  filter: drop-shadow(0 0 10px rgba(255, 149, 0, 0.35))
    drop-shadow(0 0 20px rgba(232, 62, 140, 0.25));
}

.profile-avatar[hidden] {
  display: none;
}

.profile-copy {
  min-width: 0;
}

.profile-name {
  margin: 0 0 1px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(255, 149, 0, 0.45);
}

h1 {
  overflow: hidden;
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  line-height: 1.3;
  letter-spacing: -0.035em;
  text-shadow: 0 0 18px rgba(150, 170, 255, 0.35);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-chat-link {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 10px 15px;
  border: 1px solid rgba(168, 186, 255, 0.35);
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  box-shadow: 0 0 16px rgba(120, 90, 255, 0.22);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.mobile-chat-link {
  position: relative;
  z-index: 1;
  display: none;
  color: #ffffff;
  font-size: 1.65rem;
  line-height: 1;
  text-decoration: none;
}

.header-chat-link:hover {
  border-color: rgba(198, 210, 255, 0.65);
  background: rgba(146, 116, 255, 0.24);
  box-shadow: 0 0 22px rgba(140, 110, 255, 0.4);
}

.list-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #b47700;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.list-intro h2 {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  line-height: 1.25;
  letter-spacing: -0.045em;
}

.intro-copy {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.product-count {
  flex: 0 0 auto;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.context-notice,
.status {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.context-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #52627a;
  background: #eaf3ff;
  border-color: #dbe9f9;
  font-size: 0.82rem;
}

.context-notice strong {
  color: #18263d;
  font-weight: 900;
}

.notice-content {
  min-width: 0;
  flex: 1 1 auto;
  word-break: keep-all;
  overflow-wrap: normal;
}

.notice-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

.notice-icon {
  flex: 0 0 auto;
  color: #6c829e;
  font-size: 0.9rem;
}

.status {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.status[hidden] {
  display: none;
}

.status-error {
  color: #8b2924;
  background: #fff4f3;
  border-color: #f2c9c6;
}

.status-empty {
  min-height: 160px;
  flex-direction: column;
}

.status-title {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.status-copy {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

.retry-button {
  margin-top: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  color: #ffffff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #d9dde3;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

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

.deal-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.deal-card {
  min-width: 0;
}

.deal-link {
  min-height: 142px;
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 17px;
  padding: 12px 15px 12px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.deal-link:hover {
  transform: translateY(-2px);
  border-color: #d9dde5;
  box-shadow: 0 14px 40px rgba(17, 24, 39, 0.12);
}

.deal-link:focus-visible,
.header-chat-link:focus-visible,
.chat-link:focus-visible,
.grade-tab:focus-visible,
.kakao-share:focus-visible,
.retry-button:focus-visible {
  outline: 3px solid #2878ff;
  outline-offset: 3px;
}

.deal-thumb {
  width: 122px;
  aspect-ratio: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #f2f4f8, #e4e8ef);
  color: #7b8492;
}

.deal-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumb-fallback {
  display: grid;
  gap: 4px;
  place-items: center;
  color: #77808e;
  text-align: center;
}

.thumb-fallback strong {
  color: #4d5665;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.thumb-fallback span {
  font-size: 0.72rem;
}

.deal-copy {
  min-width: 0;
}

.deal-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.sample-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf0f4;
  color: #5d6674;
}

.deal-name {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: -0.025em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.deal-price-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px;
  margin-top: 11px;
}

.price-label {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 850;
}

.deal-price {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.045em;
}

.regular-price {
  margin: 2px 0 0;
  color: #5f6673;
  font-size: 0.82rem;
  text-decoration: none;
}

.deal-arrow {
  color: #a4abb5;
  font-size: 1.55rem;
  font-weight: 300;
  line-height: 1;
}

.notice {
  margin: 0 2px 16px;
  color: #525b69;
  font-size: 0.875rem;
  line-height: 1.55;
}

.notice p {
  margin: 2px 0;
}

/* 카카오톡 공유 버튼. 카카오 브랜드 색(#FEE500 + 검정 글씨)을 그대로 씁니다. */
.kakao-share {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 12px;
  padding: 10px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fee500;
  color: #191600;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

.kakao-share:hover:not(:disabled) {
  background: #f2da00;
  transform: translateY(-1px);
}

.kakao-share[hidden] {
  display: none;
}

.kakao-share:disabled {
  opacity: 0.65;
  cursor: wait;
}

.kakao-share-status {
  margin: 0 0 12px;
  color: #9d2a24;
  font-size: 0.84rem;
}

.grade-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px 3px 9px;
  scrollbar-width: thin;
}

.grade-tabs[hidden] {
  display: none;
}

.grade-tab {
  min-width: max-content;
  flex: 1 0 110px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid #d9dde5;
  border-radius: 16px;
  background: var(--surface);
  color: #4f5866;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 850;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.grade-tab:hover {
  border-color: #bdc3cd;
  transform: translateY(-1px);
}

.grade-tab[aria-pressed="true"] {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: var(--navy);
  box-shadow: 0 7px 18px rgba(139, 96, 0, 0.16);
}

.grade-name,
.grade-flames {
  display: block;
  white-space: nowrap;
}

.grade-flames {
  font-size: 0.82rem;
  letter-spacing: -0.08em;
}

.chat-link {
  position: fixed;
  right: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 20;
  width: min(calc(100% - 32px), 728px);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 18px;
  background: var(--accent);
  box-shadow: 0 14px 36px rgba(65, 45, 0, 0.25);
  color: var(--navy);
  font-size: 1rem;
  font-weight: 900;
  text-decoration: none;
  transform: translateX(50%);
  transition: background-color 160ms ease, transform 160ms ease;
}

.chat-link:hover {
  background: var(--accent-strong);
  transform: translateX(50%) translateY(-2px);
}

.site-footer {
  padding: 24px 16px 8px;
  color: #9299a4;
  font-size: 0.75rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 44px, 760px);
  }

  .header-inner {
    min-height: 72px;
    padding-bottom: 8px;
  }

  .profile-avatar {
    width: 70px;
    height: 58px;
  }

  .header-chat-link {
    display: none;
  }

  .mobile-chat-link {
    display: block;
  }

  .list-intro {
    align-items: start;
    gap: 12px;
    margin-inline: 9px;
    padding: 18px 0 11px;
  }

  .list-intro h2 {
    font-size: 1.45rem;
  }

  .intro-copy {
    margin-top: 4px;
    font-size: 0.74rem;
  }

  .product-count {
    display: none;
  }

  .kakao-share {
    min-height: 40px;
    margin-bottom: 9px;
    font-size: 0.84rem;
  }

  .grade-tabs {
    gap: 4px;
    margin-inline: 9px;
    margin-bottom: 7px;
  }

  .grade-tab {
    flex-basis: 82px;
    min-height: 39px;
    padding: 3px 6px;
    border-radius: 9px;
    font-size: 0.63rem;
    letter-spacing: -0.06em;
  }

  .grade-flames {
    font-size: 0.61rem;
  }

  .grade-tab[aria-pressed="true"] {
    border-color: #075ed2;
    background: #0969df;
    color: #ffffff;
    box-shadow: 0 5px 12px rgba(7, 94, 210, 0.2);
  }

  .context-notice {
    min-height: 34px;
    margin-inline: 9px;
    margin-bottom: 9px;
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 0.66rem;
    letter-spacing: -0.04em;
  }

  .deal-list {
    gap: 10px;
    margin-inline: 9px;
  }

  .deal-link {
    min-height: 103px;
    grid-template-columns: 94px minmax(0, 1fr) 15px;
    gap: 10px;
    padding: 8px 10px 8px 9px;
    border-radius: 13px;
  }

  .deal-thumb {
    width: 94px;
    border-radius: 12px;
  }

  .deal-meta {
    margin-bottom: 4px;
    font-size: 0.72rem;
  }

  .deal-name {
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .deal-price-line {
    gap: 5px;
    margin-top: 7px;
  }

  .price-label {
    font-size: 0.76rem;
  }

  .deal-price {
    font-size: 1.13rem;
  }

  .regular-price {
    font-size: 0.76rem;
  }

  .deal-arrow {
    font-size: 1.25rem;
  }

  .chat-link {
    width: calc(100% - 24px);
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
@media (max-width: 560px) {
  .shell {
    width: calc(100% - 20px);
    max-width: none;
  }

  .list-intro,
  .kakao-share,
  .grade-tabs,
  .context-notice,
  .deal-list {
    margin-left: 0;
    margin-right: 0;
  }
}
