:root {
  --cream: #fff6e3;
  --paper: #fffdf7;
  --ink: #4a2c1a;
  --ink-soft: #6b4a36;
  --yellow: #f6c453;
  --yellow-soft: #fde9a8;
  --red: #c8443a;
  --red-dark: #a8362d;
  --night: #2a2b58;
  --night-soft: #3d3a7a;
  --purple: #8f7bd6;
  --purple-soft: #ece5fb;
  --line: rgba(74, 44, 26, 0.85);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }

[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--ink); color: var(--cream);
  padding: 10px 14px; border-radius: 10px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(circle at 14% 30%, rgba(255, 255, 255, 0.9) 0 1.5px, transparent 2px),
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.8) 0 1.5px, transparent 2px),
    radial-gradient(circle at 60% 70%, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 90% 74%, rgba(246, 196, 83, 0.9) 0 2px, transparent 2.5px),
    linear-gradient(160deg, var(--night) 0%, var(--night-soft) 100%);
  color: var(--cream);
  padding: 26px 0 30px;
  border-bottom: 4px solid var(--yellow);
  border-radius: 0 0 28px 28px;
}

.hero__kicker {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--night);
  background: var(--yellow);
  border-radius: 999px;
}

.hero__title {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero__lead { margin: 6px 0 0; font-size: 1.0625rem; color: #f3ead6; }

/* ---------- Notice ---------- */
.notice {
  margin: 18px 0 0;
  padding: 12px 14px;
  background: var(--yellow-soft);
  border: 2px solid var(--line);
  border-radius: 14px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.55;
}

.notice__label {
  display: inline-block;
  margin-right: 6px;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cream);
  background: var(--red);
  border-radius: 999px;
  vertical-align: 1px;
}

/* ---------- Search ---------- */
.search { margin-top: 18px; }

.search__label { display: block; margin-bottom: 6px; font-size: 0.875rem; font-weight: 700; color: var(--ink-soft); }

.search__row { display: flex; gap: 8px; }

.search__input {
  flex: 1; min-width: 0;
  height: 48px; padding: 0 16px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  -webkit-appearance: none; appearance: none;
}
.search__input::placeholder { color: #8d6f5a; }
.search__input::-webkit-search-cancel-button { display: none; }
.search__input:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

.search__status { min-height: 1.5em; margin: 8px 2px 0; font-size: 0.875rem; color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px;
  font: inherit; font-weight: 800; font-size: 1rem;
  text-decoration: none; cursor: pointer;
  border: 2px solid var(--line); border-radius: 14px;
  transition: transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }

.btn--ghost { background: var(--paper); color: var(--ink); }
.btn--ghost:hover { background: var(--yellow-soft); }

.btn--primary { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--line); }
.btn--primary:hover { background: var(--red-dark); }

.btn--night { background: var(--night); color: var(--cream); border-color: var(--night); }
.btn--night:hover { background: var(--night-soft); }

.btn--disabled { background: #eadfcb; color: var(--ink-soft); cursor: default; box-shadow: none; }

.btn--close { min-height: 44px; background: var(--yellow); color: var(--ink); }

/* ---------- Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 6px;
}

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
}

.loading { margin: 24px 0; text-align: center; color: var(--ink-soft); }

.card {
  position: relative;
  scroll-margin-top: 16px;
  padding: 16px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 rgba(74, 44, 26, 0.14);
}

.card.is-target { outline: 4px solid var(--purple); outline-offset: 3px; }
.card:focus { outline: 4px solid var(--purple); outline-offset: 3px; }

.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: inline-block; padding: 1px 12px;
  font-size: 0.8125rem; font-weight: 800;
  color: var(--ink); background: var(--yellow);
  border: 2px solid var(--line); border-radius: 999px;
}

.tag {
  padding: 1px 10px;
  font-size: 0.75rem; font-weight: 700;
  color: var(--night); background: var(--purple-soft);
  border-radius: 999px;
}

.card__body { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: start; }

.thumb {
  position: relative; display: block; width: 112px; padding: 0;
  background: var(--purple-soft);
  border: 2px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: zoom-in;
  font: inherit; color: inherit;
}
.thumb img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; object-position: top; }
.thumb__hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 0; text-align: center;
  font-size: 0.6875rem; font-weight: 800; color: #fff;
  background: rgba(42, 43, 88, 0.88);
}

.thumb--missing, .viewer__missing {
  display: grid; place-items: center; text-align: center;
  padding: 10px; aspect-ratio: 2 / 3;
  font-size: 0.75rem; color: var(--ink-soft);
}

.card__title { margin: 0; font-size: 1.1875rem; line-height: 1.35; letter-spacing: -0.01em; }

.card__label { margin: 10px 0 0; font-size: 0.75rem; font-weight: 800; color: var(--purple); letter-spacing: 0.02em; }
.card__product { margin: 0; font-size: 1.0625rem; font-weight: 800; }
.card__desc { margin: 6px 0 0; font-size: 0.9375rem; color: var(--ink-soft); }

.card__foot { margin-top: 14px; }
.card__foot .btn { width: 100%; }

.card__meta {
  display: flex; justify-content: space-between; gap: 8px;
  margin: 10px 2px 0; font-size: 0.75rem; color: var(--ink-soft);
}
.card__meta a { color: inherit; text-underline-offset: 3px; }

@media (max-width: 359px) {
  .card__body { grid-template-columns: 1fr; }
  .thumb { width: 140px; }
}

/* ---------- Empty / error ---------- */
.panel {
  margin: 18px 0; padding: 22px 18px; text-align: center;
  background: var(--paper);
  border: 2px dashed var(--line); border-radius: var(--radius);
}
.panel__title { margin: 0 0 4px; font-size: 1.0625rem; font-weight: 800; }
.panel__text { margin: 0 0 14px; color: var(--ink-soft); font-size: 0.9375rem; }

/* ---------- Footer ---------- */
.footer { margin-top: 36px; padding: 28px 0 40px; background: var(--purple-soft); border-top: 4px solid var(--purple); }
.footer .btn { width: 100%; }
.footer__text { margin: 14px 2px 0; font-size: 0.875rem; color: var(--ink-soft); }
.footer__text--small { font-size: 0.8125rem; }

@media (min-width: 700px) {
  .footer .btn { width: auto; }
}

/* ---------- Viewer (dialog) ---------- */
.viewer {
  width: min(100vw, 760px); max-width: 100vw;
  height: 100dvh; max-height: 100dvh;
  margin: 0 auto; padding: 0;
  color: var(--ink); background: var(--cream);
  border: 0; overflow: hidden;
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(26, 27, 58, 0.82); }

.viewer__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: var(--paper); border-bottom: 2px solid var(--line);
}
.viewer__title { margin: 0; font-weight: 800; font-size: 0.9375rem; line-height: 1.35; }
.viewer__body { flex: 1; overflow: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.viewer__body img { width: 100%; height: auto; margin: 0 auto; border-radius: 10px; }
