/* Theme tokens — adjust here to retune the whole UI (.cursorrules: CSS vars). */
:root {
  --color-primary: #3f6b3a;
  --color-primary-dark: #2d4f29;
  --color-accent: #c44a2b;
  --color-bg: #faf6ef;
  --color-surface: #ffffff;
  --color-text: #2e2a25;
  --color-muted: #6a6357;
  --color-border: #e7e1d4;
  --color-disabled: #c8c4bd;
  /* Recommendation badge — sits over photographs, so it is its own token
     rather than a reuse of accent/primary. */
  --color-badge: #ffd400;
  --color-badge-text: #2e2a25;
  /* Pressed/hover state for accent-filled buttons (the quantity "+"). */
  --color-accent-dark: #a83c22;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  --radius: 0.5rem;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-summary: 0 -2px 8px rgba(0, 0, 0, 0.06);

  /* Seed only: every measure below is derived from it. */
  --max-width: 720px;

  /* ---- page grid ----
     --page-max is the CONTENT measure: the width INSIDE the gutters. It is NOT
     a border-box max-width, so do not "restore" it to 720px — seeding it as
     720 - 2*gutter is what keeps every viewport <= 720px byte-identical to the
     old .container. A page opts into a wider measure by redeclaring it
     (body.page-order, body.page-narrow, .container-narrow). */
  --page-gutter: var(--space-md);
  --page-max: calc(var(--max-width) - 2 * var(--page-gutter));

  --rail-w: 400px;                 /* order rail on wide screens */
  --col-gap: var(--space-xl);      /* gap between the product column and the rail */
}

/* The `hidden` attribute must always win. Several components set
   display:flex/grid on classes (.summary-row, .cart-list, .order-row, ...)
   which would otherwise override the UA `[hidden]{display:none}` rule and
   keep "hidden" elements (e.g. the gift-wrap summary row) visible. */
[hidden] { display: none !important; }

/* ---------- per-company themes (set by assets/theme.js from ?theme=<id>) ----------
   Only override the tokens that should change. Anything not listed inherits
   from :root above. Placeholder hex values below — replace with the official
   brand colors once they're confirmed. */

/* 우아한형제들 (Woowa Brothers) — mint/teal palette */
[data-theme="woowa"] {
  --color-primary: #2AC1BC;        /* TODO: replace with confirmed brand color */
  /* Dark enough to be a text colour: 4.82 on white, 4.58 on the tinted bg.
     The old #1FA09C was 3.20/3.03, under the 4.5 AA bar for the section titles,
     totals and links that all read from this token. */
  --color-primary-dark: #157F7B;   /* TODO: darker shade of --color-primary */
  /* 4.21 on white, both as the sale price and as white-on-fill for the "+".
     The old #FF7A59 was 2.57, which fails even the large-text bar. */
  --color-accent: #D4502C;         /* TODO: secondary/CTA color */
  --color-accent-dark: #B03D1C;    /* hover for the accent-filled "+" */
  --color-bg: #F1FBFA;             /* TODO: page background tint */
  --color-badge: #2AC1BC;          /* brand mint reads as the recommendation */
  --color-badge-text: #0D3F3D;     /* 5.26 on the mint; white was 2.22 */
}

/* 카카오 (Kakao) — yellow + dark brown palette
   NOTE: Kakao yellow (#FEE500) is too light for white header text. The header
   uses --color-surface on top of --color-primary, so when --color-primary is
   yellow, --color-surface must flip to dark to keep the header readable. */
[data-theme="kakao"] {
  --color-primary: #FEE500;        /* Kakao yellow */
  --color-primary-dark: #3C1E1E;   /* dark brown — used as text/accent color so kakao text reads black */
  --color-accent: #3C1E1E;         /* Kakao dark brown */
  --color-bg: #FFFEF2;             /* warm yellow tint (original) */
  --color-surface: #FFFFFF;        /* card surface stays white */
  --color-text: #1a1a1a;           /* body text near-black */
  --color-muted: #5b5b4a;          /* secondary text near-black */
  --color-accent-dark: #2A1414;    /* hover for the accent-filled "+" */
  --color-badge: #FEE500;          /* Kakao yellow */
  --color-badge-text: #3C1E1E;     /* white is unreadable on it */
}
/* Header text needs to flip to dark on the yellow background. */
[data-theme="kakao"] .site-header { color: #3C1E1E; }
[data-theme="kakao"] .brand-link:focus-visible { outline-color: #3C1E1E; }
/* The submit button + .btn.primary use --color-surface for their text color,
   which is white by default — unreadable on yellow. Force dark text on these
   primary surfaces just for the kakao theme. */
[data-theme="kakao"] .submit-btn,
[data-theme="kakao"] .btn.primary,
[data-theme="kakao"] .refresh-btn.primary,
[data-theme="kakao"] .page-action-link:hover,
[data-theme="kakao"] .page-action-link:focus-visible,
[data-theme="kakao"] .zip-search-btn:hover {
  color: #3C1E1E;
}
/* primary-dark is now dark brown (a text color), so the primary buttons'
   default hover (background: var(--color-primary-dark)) would be brown text on
   brown. Keep their hover a deeper yellow with dark text instead. */
[data-theme="kakao"] .submit-btn:hover:not(:disabled),
[data-theme="kakao"] .btn.primary:hover,
[data-theme="kakao"] .refresh-btn.primary:hover {
  background: #E6CF00;
  color: #3C1E1E;
}

/* ---------- theme welcome banner (injected by theme.js) ---------- */
.theme-welcome {
  /* Inline inset comes from the page-band rule near .container. */
  margin-block: var(--space-sm) 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-surface);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
}
/* A light brand background needs dark text for the same readability reason as
   the header above: white on Kakao yellow and on Woowa mint is 1.3 and 2.2. */
[data-theme="kakao"] .theme-welcome { color: #3C1E1E; }
[data-theme="woowa"] .theme-welcome { color: #0D3F3D; }

/* ---------- floating theme character (injected by theme.js) ----------
   Top-left corner so it doesn't collide with the KakaoTalk FAB (bottom-right)
   or the sticky summary bar. Shrinks on mobile. pointer-events: none keeps
   it purely decorative — never blocks taps. */
.theme-character {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 72px;
  height: 72px;
  object-fit: contain;
  z-index: 40;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}
@media (max-width: 480px) {
  .theme-character { width: 56px; height: 56px; top: 8px; left: 8px; }
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

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

button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}

/* ---------- header ---------- */

.site-header {
  padding-block: var(--space-md);
  background: var(--color-primary);
  color: var(--color-surface);
  text-align: center;
}
.site-header .brand {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  display: flex;
  justify-content: center;
}
.brand-link {
  display: inline-flex;
  text-decoration: none;
  color: inherit;
}
.brand-link:focus-visible {
  outline: 2px solid var(--color-surface);
  outline-offset: 2px;
  border-radius: 4px;
}
.brand-logo {
  display: block;
  max-height: 64px;
  width: auto;
  object-fit: contain;
}
@media (max-width: 380px) {
  .brand-logo { max-height: 48px; }
  /* --page-gutter feeds the band rule, so the inline inset shrinks with it. */
  .site-header { padding-block: var(--space-sm); --page-gutter: var(--space-sm); }
}

/* ---------- notice marquee (전광판) ---------- */
.notice-banner {
  background: #1f2937;
  color: #fef3c7;
  font-size: 0.9375rem;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
/*
 * Burst pattern: padding-left: 100% pushes the start of the text fully
 * off-screen to the right. The keyframe then translates the entire track
 * leftward by 100% of its own width (= viewport + content width), so the
 * content streams in from the right and exits past the left edge before
 * looping.
 */
.notice-track {
  display: inline-block;
  padding: 8px 0;
  padding-left: 100%;
  animation: notice-marquee var(--marquee-duration, 24s) linear infinite;
}
.notice-track:hover { animation-play-state: paused; }
.notice-content {
  display: inline-block;
  padding: 0 24px;
}
@keyframes notice-marquee {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-100%, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .notice-track {
    animation: none;
    padding-inline: max(var(--page-gutter), calc((100% - var(--page-max)) / 2));
    display: block;
    white-space: normal;
  }
}

/* ---------- 한정수량 이벤트 배너 (캐러셀) ----------
   디자인 시안: docs/galbi_promo_banners.html — 둥근 모서리 카드 + 우측 데코
   원 + 좌측 eyebrow/title/sub 구조. 시트 텍스트만으로 운영 가능하면서 사장님이
   따로 디자인 이미지를 만들 필요가 없도록, 슬라이드별 톤은 nth-child 로 자동
   순환된다 (한식 빨강 → 베이지 → 네이비 → 핑크). 배너가 1장이면 빨강 톤 한 가지. */
.event-banner-carousel {
  position: relative;
  /* Inline inset comes from the page-band rule near .container. */
  margin-block: var(--space-sm) 0;
  overflow: hidden;
  border-radius: 16px;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.event-banner-carousel:active { cursor: grabbing; }
.event-banner-track {
  display: flex;
  transition: transform 0.3s ease;
  will-change: transform;
}
.event-banner-slide {
  position: relative;
  flex: 0 0 100%;
  min-height: 110px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  overflow: hidden;
  /* 톤 1 — 갈비 빨강 (기본). --deco-color 는 큰 원, --accent-color 는 작은 도트. */
  --deco-color: #CC5847;
  --accent-color: #FFE8D6;
  background: #B0392C;
  color: #FFE8D6;
}
/* 슬라이드 톤 자동 순환 — 사장님은 시트에 문구만 적으면 자동 다양화.
   작은 액센트 도트는 톤의 텍스트색을 따라가 어느 톤에서도 어색하지 않게. */
.event-banner-slide:nth-child(4n+2) {
  --deco-color: #F4D198;
  --accent-color: #5D2C0F;
  background: #FBE8C9;
  color: #5D2C0F;
}
.event-banner-slide:nth-child(4n+3) {
  --deco-color: #2C4E7C;
  --accent-color: #DBE9F7;
  background: #1F3A5F;
  color: #DBE9F7;
}
.event-banner-slide:nth-child(4n+4) {
  --deco-color: #E5A8B5;
  --accent-color: #6B1F33;
  background: #EFC8D0;
  color: #6B1F33;
}

/* 우측 데코 — 큰 원 2개 + 작은 액센트 도트 2개. 카드 모서리 밖으로 일부가
   잘려 보이는 게 미감의 핵심이라 음수 위치값을 적극 사용. */
.event-banner-deco {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.event-banner-deco-1,
.event-banner-deco-2 { background: var(--deco-color); }
.event-banner-deco-3,
.event-banner-deco-4 {
  /* 텍스트색을 그대로 가져오면 너무 진해 보일 수 있어 opacity 로 살짝 약화. */
  background: var(--accent-color);
  opacity: 0.55;
}
.event-banner-deco-1 { top: -30px; right: 28%; width: 80px; height: 80px; }
.event-banner-deco-2 { bottom: -40px; right: 6%; width: 120px; height: 120px; }
.event-banner-deco-3 { top: 24px; right: 46%; width: 14px; height: 14px; }
.event-banner-deco-4 { bottom: 30px; right: 44%; width: 10px; height: 10px; }

.event-banner-content {
  position: relative;
  z-index: 2;
  /* flex:1 + min-width:0 으로 슬라이드 안에서 가능한 가로 공간을 다 쓰고,
     padding-right 로 우측 큰 데코 원(deco-2, width 120px) 자리만 확보. 짧은
     문구는 좌측에 정렬돼 보이고, 긴 문구는 한 줄로 길게 늘어나며 데코를 거의
     끝까지 침범하지 않는다. */
  flex: 1;
  min-width: 0;
  padding-right: 110px;
}
.event-banner-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 0.88;
  margin-bottom: 4px;
}
.event-banner-title {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.event-banner-sub {
  font-size: 0.8125rem;
  opacity: 0.9;
  margin-top: 6px;
}

/* 닷 — 모든 톤(어두운/밝은 배너 모두)에서 보이도록 흰색 + 어두운 테두리. */
.event-banner-dots {
  position: absolute;
  right: 14px;
  bottom: 10px;
  display: flex;
  gap: 5px;
  pointer-events: none;
  z-index: 3;
}
.event-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.2);
  transition: background 150ms ease, transform 150ms ease;
}
.event-banner-dot.is-active {
  background: #ffffff;
  transform: scale(1.2);
}

/* 모바일 — 카드 마진/패딩 줄이고 폰트 한 단계 작게. 데코 원도 비례 축소. */
@media (max-width: 480px) {
  .event-banner-carousel,
  .theme-welcome {
    --page-gutter: var(--space-sm);
    margin-block: var(--space-sm) 0;
    border-radius: 12px;
  }
  .event-banner-slide {
    min-height: 92px;
    padding: 16px 18px;
  }
  .event-banner-content { padding-right: 78px; }
  .event-banner-eyebrow { font-size: 0.625rem; margin-bottom: 3px; }
  .event-banner-title { font-size: 1.0625rem; }
  .event-banner-sub { font-size: 0.75rem; margin-top: 4px; }
  .event-banner-deco-1 { top: -22px; right: 28%; width: 60px; height: 60px; }
  .event-banner-deco-2 { bottom: -28px; right: 6%; width: 84px; height: 84px; }
  .event-banner-deco-3 { top: 16px; right: 50%; width: 10px; height: 10px; }
  .event-banner-deco-4 { bottom: 18px; right: 44%; width: 8px; height: 8px; }
  .event-banner-dots { right: 10px; bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .event-banner-track { transition: none; }
}

/* ---------- page actions (전광판 아래 우측 버튼 행) ---------- */
.page-actions {
  display: flex;
  flex-wrap: wrap;
  /* flex-end, never space-between: both pages carry a single child, which
     space-between would push to the left edge. */
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-block: var(--space-sm) 0;
}
.page-action-link {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--color-primary);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: var(--color-surface);
  text-decoration: none;
  text-align: center;
  transition: background 120ms ease, color 120ms ease;
}
.page-action-link:hover,
.page-action-link:focus-visible {
  background: var(--color-primary);
  color: var(--color-surface);
  outline: none;
}
/* On narrow screens, let the buttons share the row evenly instead of
   overflowing / crowding to the right. */
@media (max-width: 480px) {
  .page-actions { justify-content: stretch; }
  .page-action-link { flex: 1 1 0; min-width: 0; padding: 9px 8px; }
}
.site-header .tagline {
  margin: var(--space-xs) 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* ---------- layout ---------- */

.container {
  padding-block: var(--space-md);
}

/* ---------- page bands ----------
   One formula for every horizontal band: the background stays full-bleed, the
   content lands on the page grid. The percentage resolves against <body>, and
   every band is a direct child of <body>, so they all resolve identically.
   Do NOT wrap the shell in an element — it would shift every band's inset at
   once AND break the sibling-insert anchors in notices.js (header.afterend),
   event-banner.js (.notice-banner/.site-header afterend) and theme.js
   (insertBefore(anchor.nextSibling) on .page-actions).
   .notice-banner is a deliberate exception: .notice-track's padding-left: 100%
   is the marquee runway, and notices.js derives the scroll duration from the
   rendered track width. */
.site-header,
.page-actions,
.container {
  padding-inline: max(var(--page-gutter), calc((100% - var(--page-max)) / 2));
}
/* Rounded cards with a background of their own — inset, not padded. Under
   box-sizing: border-box both forms land on the same two vertical lines. */
.event-banner-carousel,
.theme-welcome {
  margin-inline: max(var(--page-gutter), calc((100% - var(--page-max)) / 2));
}
/* Pages with a sticky summary bar reserve bottom space so the last content
   (e.g. the qna images) isn't hidden behind it. The summary height is variable
   (item count, collapsed state, action row), so app.js/group.js override this
   with the live height via ResizeObserver. This is the pre-JS fallback. */
.container.has-summary { padding-bottom: 22rem; }

.section-title {
  font-size: 1.125rem;
  margin: var(--space-lg) 0 var(--space-md);
  color: var(--color-primary-dark);
}

/* ---------- hero grid (4-up promo videos above 상품 선택) ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.hero-grid img,
.hero-grid video {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--color-bg);
  display: block;
}

/* ---------- product grid ---------- */

.product-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .product-grid { grid-template-columns: 1fr 1fr; }
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  box-shadow: var(--shadow-card);
}

.product-card.sold-out {
  filter: grayscale(1);
  opacity: 0.65;
}

.product-image {
  aspect-ratio: 4 / 3;
  background: var(--color-bg);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.875rem;
  position: relative;
}
.product-image img {
  width: 100%;
  height: 100%;
  /* 상품 이미지는 비율이 제각각(1:1, 16:9 등)이라 cover로 채우면 가장자리 글자가
     잘린다. contain으로 전체를 보여주고, 비율 차이는 .product-image 의 배경
     여백으로 채운다. */
  object-fit: contain;
}

.sold-badge {
  position: absolute;
  left: var(--space-sm);
  bottom: var(--space-sm);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.best-badge {
  position: absolute;
  left: var(--space-sm);
  top: var(--space-sm);
  /* A pill with dark text: it has to sit over photographs of raw meat, where
     a red badge low-contrasts against the subject. Themed via --color-badge. */
  background: var(--color-badge);
  color: var(--color-badge-text);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* 한정수량 이벤트 배지 — best-badge 와 같은 자리(좌상단)인데 이벤트 우선
   노출이라 다른 배지는 app.js 에서 mutually exclusive 로 처리. */
.event-badge {
  position: absolute;
  left: var(--space-sm);
  top: var(--space-sm);
  background: #d62828;
  color: #fff;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
/* 재고 소진 시 카드를 회색 처리. sold-out 의 빨간 "품절" 과 시각적으로 구분. */
.product-card.event-ended .product-image img,
.product-card.event-ended .product-image { filter: grayscale(1) opacity(0.6); }
.product-card.event-ended .product-name,
.product-card.event-ended .product-origin,
.product-card.event-ended .product-desc,
.product-card.event-ended .product-price { color: var(--color-muted); }
.event-ended-badge {
  position: absolute;
  left: var(--space-sm);
  bottom: var(--space-sm);
  background: rgba(60, 60, 60, 0.85);
  color: #fff;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.event-stock {
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #d62828;
}
.event-stock .total { color: var(--color-muted); font-weight: 500; }
.event-gate {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.75rem;
  color: var(--color-muted);
  font-style: italic;
}

.product-name {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

/* Origin and serving size, set as one chip: they are specification, not prose,
   and reading as a unit keeps them from competing with the product name. */
/* Origin chip on the left, review link pushed to the right end. `min-width: 0`
   on the chip is what lets it ellipsis instead of shoving the link out of the
   column. */
.product-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.product-spec {
  display: inline-block;
  min-width: 0;
  align-self: flex-start;
  margin: 0;
  padding: 3px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--color-muted);
}
.product-list-view .product-spec {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-desc {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin: 0;
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}
.product-price .original {
  color: var(--color-muted);
  text-decoration: line-through;
  font-size: 0.875rem;
}
.product-price .sale {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}
.product-price .won {
  font-size: 0.7em;
  font-weight: 600;
  margin-left: 1px;
}

/* 네이버 스토어 리뷰로 가는 링크 — 알약형 초록 버튼으로 강조.
   색은 테마와 무관하게 네이버 브랜드 그린으로 고정(목적지가 네이버이므로). */
.product-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  background: #03c75a;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(3, 199, 90, 0.35);
  transition: background 0.15s ease, transform 0.05s ease;
}
.product-link:hover { background: #02b350; text-decoration: none; }
.product-link:active { transform: translateY(1px); }

/* ---------- qty control ---------- */

/* D7: Album wrappers preserve the existing flex layout; list mode groups
   information and purchase controls without duplicating interactive inputs. */
.product-details, .product-purchase { display: contents; }
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-md);
}
.products-toolbar .section-title { margin: 0; }
.product-view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 3px;
  background: var(--color-surface);
  gap: 3px;
}
.product-view-toggle button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.product-view-toggle button[aria-pressed="true"] {
  background: var(--color-text);
  color: #fff;
  font-weight: 700;
}
.product-view-toggle button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
/* ---------- list view ----------
   Three zones: square thumbnail | identity | purchase rail. The rail is fenced
   off with a rule rather than only whitespace, so "what it is" and "what you
   buy" never blur into one another. */
.product-grid.product-list-view { grid-template-columns: minmax(0, 1fr); }
.product-list-view .product-card {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: stretch;
  column-gap: var(--space-md);
  row-gap: 0;
  /* Not every product has a review link or a description, and a short card next
     to a full one is exactly the uneven spacing this layout removes. Pinned to
     the thumbnail rather than to a round number: at 192px the row was 19px
     taller than the 140px photo, which sits at align-self: start, so every card
     had visibly more space under the photo than above it. Both other columns
     now fit inside 140px (details 122, rail 131), so nothing is squeezed. */
  min-height: calc(140px + 2 * var(--space-md));
}
.product-list-view .product-image {
  grid-column: 1;
  align-self: start;
  width: 140px;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--radius);
}
/* Square photos in a square box, so nothing is cropped. */
.product-list-view .product-image img { object-fit: cover; }
/* Sized to stay on one line across the 140px thumbnail — wrapped, it swallowed
   most of the photo. */
.product-list-view .best-badge,
.product-list-view .event-badge {
  left: 6px;
  top: 6px;
  padding: 3px 8px;
  font-size: 0.6875rem;
  letter-spacing: 0;
  white-space: nowrap;
}

/* Identity column — chip, name, description, and the review link pinned to
   the bottom so it lines up with the foot of the thumbnail. */
.product-list-view .product-details {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* Top-aligned, not centred: the origin/review row has to start level with
     the top edge of the photo beside it. */
  justify-content: flex-start;
  min-width: 0;
  gap: 6px;
}
/* Clamped to two lines AND floored at two lines: without the floor a
   one-line name makes its row 24px shorter than its neighbours, which is the
   uneven spacing this layout is meant to remove. */
.product-list-view .product-name {
  font-size: 1.0625rem;
  line-height: 1.35;
  min-height: calc(1.35em * 2);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.product-list-view .product-desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  min-height: calc(1.5em * 2);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Purchase rail — price on top, then one labelled box per control. */
.product-list-view .product-card .product-purchase {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
  gap: 8px;
  margin: 0;
  padding-left: var(--space-md);
  border-left: 1px solid var(--color-border);
}
.product-list-view .product-card .product-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  margin: 0 0 2px;
}
.product-list-view .product-card .product-price .sale { font-size: 1.375rem; }
.product-list-view .product-card .event-stock { margin: 0; text-align: right; }
.product-list-view .product-card .qty-control,
.product-list-view .product-card .wrap-control {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}
.product-list-view .product-card .qty-btn {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 6px;
  font-size: 0.875rem;
}
/* The wrap stepper's buttons live one level deeper than the quantity ones, so
   its inner gap has to be set to match rather than inherited. */
.product-list-view .product-card .wrap-stepper { gap: 6px; }
.product-list-view .product-card .qty-control,
.product-list-view .product-card .wrap-control { gap: 6px; padding: 6px; }
.product-list-view .product-card .qty-value,
.product-list-view .product-card .wrap-value { min-width: 18px; font-size: 0.875rem; }
/* The rail ran ~19px taller than the 140px thumbnail, so the row was sized by
   the controls and the photo sat with visibly more space below it than above.
   These trims put the rail under 140px, which makes the image the tallest thing
   in the row and the card's 16px padding read even on both sides. */
.product-list-view .product-card .product-purchase { gap: 6px; }
.product-list-view .product-card .product-price .sale { font-size: 1.1875rem; }
.product-list-view .product-card .product-price .original { font-size: 0.8125rem; }
.product-list-view .product-card .qty-control,
.product-list-view .product-card .wrap-control { padding: 5px 6px; }
.product-list-view .product-card .qty-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  font-size: 0.875rem;
}

@media (max-width: 860px) {
  /* No room for a third column: the rail drops beneath both, and its rule
     turns from a left edge into a top edge. */
  .product-list-view .product-card {
    grid-template-columns: 120px minmax(0, 1fr);
    row-gap: 12px;
  }
  .product-list-view .product-image { width: 120px; }
  .product-list-view .product-details { grid-column: 2; }
  /* Two columns rather than a stack: price on the left, the quantity and gift
     wrap boxes on the right, so the row stays short. Only the boxes get an
     explicit row — event stock auto-places on the row beneath them. */
  .product-list-view .product-card .product-purchase {
    grid-column: 1 / -1;
    display: grid;
    /* Price takes the slack; the control boxes shrink to what they actually
       need. The other way round stretched the boxes and squeezed the price
       into a 72px column. */
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    padding-left: 0;
    padding-top: 12px;
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }
  .product-list-view .product-card .product-price {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-items: flex-start;
    align-self: center;
    margin: 0;
  }
  .product-list-view .product-card .qty-control { grid-column: 2; grid-row: 1; }
  .product-list-view .product-card .wrap-control { grid-column: 2; grid-row: 2; }
  .product-list-view .product-card .event-stock {
    grid-column: 1 / -1;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .product-list-view .product-card {
    grid-template-columns: 92px minmax(0, 1fr);
    column-gap: 12px;
    padding: 12px;
  }
  .product-list-view .product-image { width: 92px; }
  /* One line does not fit across a 92px thumbnail, and the image clips the
     overflow — so the badge spans the width and wraps instead. */
  .product-list-view .best-badge,
  .product-list-view .event-badge {
    left: 4px;
    right: 4px;
    top: 4px;
    padding: 2px 4px;
    font-size: 0.5625rem;
    line-height: 1.3;
    white-space: normal;
    text-align: center;
  }
  .product-list-view .product-name { font-size: 0.9375rem; }
  .product-list-view .product-card .product-price .sale { font-size: 1.125rem; }
}

.qty-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  justify-content: flex-end;
}
.qty-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  font-size: 1.125rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-primary);
}
.qty-btn:disabled {
  cursor: not-allowed;
  color: var(--color-disabled);
}
.qty-value {
  min-width: 2rem;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- per-product gift wrap ---------- */

.wrap-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.wrap-stepper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: flex-end;
}
.wrap-value {
  min-width: 4rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- group order (multi-shipment) ---------- */

/* ---------- album view purchase block ----------
   One item per row: price, review link, then each control inside its own
   bordered box, so a card reads like a miniature product page. The list view
   overrides all of this earlier in the file with its compact two-column bar. */
/* Same split as the narrow list row: price on the left taking the slack, the
   two control boxes stacked on the right at only the width they need. */
.product-card .product-purchase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  margin-top: auto;
}
.product-card .product-price {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin: 0;
}
.product-card .product-price .sale { font-size: 1.25rem; }
.product-card .qty-control { grid-column: 2; grid-row: 1; margin: 0; }
.product-card .wrap-control { grid-column: 2; grid-row: 2; margin: 0; }
/* No explicit row, so it lands on the row beneath both boxes. */
.product-card .event-stock { grid-column: 1 / -1; margin: 0; }
/* A small chip that sits opposite the origin, not a call-to-action button —
   the order happens in the boxes below, not here. */
.product-card .product-link,
.product-list-view .product-card .product-link {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  max-width: none;
  margin: 0;
  padding: 3px 9px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.4;
  border-radius: 999px;
  box-shadow: none;
  text-align: center;
  white-space: nowrap;
  -webkit-line-clamp: none;
}
/* Each control is framed so it reads as a thing you act on, not as text.
   .product-row is the per-shipment line on group.html — same control, same
   frame, so the two order pages behave identically. */
.product-card .qty-control,
.product-card .wrap-control,
.product-row .qty-control,
.product-row .wrap-control {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 6px;
  background: var(--color-surface);
}
.product-card .qty-control,
.product-row .qty-control { justify-content: flex-end; gap: 6px; }
.product-row .qty-control,
.product-row .wrap-control { margin: 0; }
/* Names each control box. `margin-right: auto` is what splits the box into a
   label on the left and its stepper on the right. */
.qty-label,
.wrap-label {
  margin-right: auto;
  padding-left: 2px;
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}
.product-card .qty-btn,
.product-row .qty-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 6px;
  font-size: 0.9375rem;
}
/* The plus button is the card's primary action, so it carries the fill. */
.product-card .qty-control .qty-btn:last-child:not(:disabled),
.product-row .qty-control .qty-btn:last-child:not(:disabled) {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 700;
}
.product-card .qty-control .qty-btn:last-child:not(:disabled):hover,
.product-row .qty-control .qty-btn:last-child:not(:disabled):hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}
.product-card .qty-value,
.product-card .wrap-value,
.product-row .qty-value,
.product-row .wrap-value { min-width: 20px; font-size: 0.875rem; }
.product-card .wrap-control,
.product-row .wrap-control {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.product-card .wrap-stepper,
.product-row .wrap-stepper { gap: 6px; }
/* Wrapping is not selectable yet: the stepper holds its place, greyed out. */
.wrap-stepper.is-off .wrap-value { color: var(--color-disabled); }

.group-intro {
  margin: 0;
  color: var(--color-muted, inherit);
  line-height: 1.6;
}
.shipment-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--color-bg);
}
.shipment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.shipment-title {
  margin: 0;
  font-size: 1.05rem;
}
.shipment-remove {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  color: var(--color-danger, #d23);
}
.ship-products {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
/* The shipment rows take the shape of the main order page's list view, minus
   the photo and the description: name over price on the left, the two control
   boxes on the right — two lines against two lines. A shipment lists every
   product, so a row that reads at a glance matters more here than the artwork
   does. */
.product-row {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
  display: grid;
  /* Each row is its own grid, so a content-sized rail is measured per row and
     the event giveaway line — the one product with no gift-wrap box — sits 44px
     further right than the rest. A fixed track is what lines them all up. It has
     to clear the widest rail content (the 선물포장 box: label + stepper); on
     narrow screens that content shrinks instead (smaller type and steppers) —
     the labels never wrap. Retune together with --ship-rail-w in the narrow
     block below. */
  grid-template-columns: minmax(0, 1fr) var(--ship-rail-w, 220px);
  align-items: start;
  column-gap: var(--space-md);
}
.product-row.sold-out { opacity: 0.5; }
.product-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  align-self: center;
}
.product-row-name { font-weight: 600; }
.product-row .event-stock { margin: 0; }
.product-row-purchase {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  padding-left: var(--space-md);
  border-left: 1px solid var(--color-border);
}
/* Size, weight and colour now come from .product-price / .original / .sale,
   shared with the main order page. */
.product-row-price { margin-top: 2px; }

/* Narrow screens keep the split: the controls belong beside the name, not
   stacked under it. The rail pays for the room — 11px labels, 24px steppers and
   tighter padding — and the gift-wrap label carries no fee (see D2 below), which
   gets the rail to 150px. The floor has to drop with it, or the 220px one above
   would eat the name column whole; it also has to stay AT the rail's real width,
   or the event giveaway row (no gift-wrap box) shrinks below the others and
   their edges stop lining up. */
@media (max-width: 560px) {
  .product-row {
    /* D2: measured floor — 수량 선택 / 선물포장 next to a 24px stepper needs
       146px, so 150 is that plus a couple of px of slack for font stacks that
       set Korean wider than ours. It was 180px while the label still carried
       "(+4,000원)"; dropping that text (D1) is what buys the product name the
       other 30px. Labels still ellipsis rather than break, so a font that
       overruns the floor degrades quietly instead of stacking. */
    --ship-rail-w: 150px;
    column-gap: var(--space-sm);
  }
  .product-row-purchase {
    padding-left: var(--space-sm);
    gap: 6px;
  }
  .product-row .qty-label,
  .product-row .wrap-label {
    min-width: 0;
    font-size: 0.6875rem;
  }
  /* Neither label may break. If one ever runs out of room it degrades to an
     ellipsis rather than to a second line. */
  .product-row .qty-label,
  .product-row .wrap-label { overflow: hidden; text-overflow: ellipsis; }
  .product-row .qty-control,
  .product-row .wrap-control { padding: 5px; gap: 4px; }
  .product-row .wrap-stepper { gap: 4px; }
  .product-row .qty-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 0.875rem;
  }
  .product-row .qty-value,
  .product-row .wrap-value { min-width: 16px; font-size: 0.8125rem; }
  .product-row-name { font-size: 0.9375rem; }
  /* On a 360px phone the name column is ~105px, which the list price and the
     sale price cannot share on one line — let them stack instead of spilling
     out of the column. */
  .product-row .product-price {
    flex-wrap: wrap;
    gap: 0 var(--space-sm);
  }
  .product-row .product-price .sale { font-size: 1rem; }
  .product-row .product-price .original { font-size: 0.75rem; }
}
.ship-subtotal {
  margin-top: var(--space-md);
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}
.add-shipment-btn {
  width: 100%;
  border: 1px dashed var(--color-primary);
  background: var(--color-surface);
  /* NOT --color-primary: that token is Kakao yellow (contrast 1.28 on white)
     and mint (2.22) under the other themes. A theme may recolour this button's
     border; the label has to stay legible. */
  color: var(--color-text);
  border-radius: var(--radius);
  padding: var(--space-sm);
  font-size: 0.95rem;
  font-weight: 600;
}

/* 대량주문 안내 박스 */
.bulk-notice p { margin: 0 0 var(--space-sm); line-height: 1.6; }
.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.bulk-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.bulk-link:hover { background: var(--color-bg); }
.bulk-hint {
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ---------- order confirmation: group shipment cards ---------- */

.o-shipments {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.o-shipment-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  background: var(--color-bg);
}
.o-shipment-title {
  margin: 0 0 var(--space-sm);
  font-size: 1rem;
}
.o-shipment-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: 0.9rem;
  padding: 0.15rem 0;
}
.o-shipment-meta-label { color: var(--color-muted, inherit); }
.o-shipment-meta-value { text-align: right; }
.o-shipment-subtotal {
  margin-top: var(--space-sm);
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}
.o-shipment-tracking {
  margin-top: var(--space-sm);
  font-size: 0.9rem;
}

/* ---------- form sections (1.4) ---------- */

.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-md) var(--space-lg);
  margin-top: var(--space-md);
  box-shadow: var(--shadow-card);
}
.form-section .section-title { margin-top: 0; }

.form-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  border: none;
  padding: 0;
  margin: 0;
}
.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}
.field-label em {
  color: var(--color-accent);
  font-style: normal;
  margin-left: 2px;
}
.field-help {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: var(--space-xs);
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="password"],
.field textarea {
  width: 100%;
  padding: 0.625rem var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  /* 16px keeps iOS from auto-zooming on focus. */
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  transition: border-color 120ms ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(63, 107, 58, 0.15);
}
.field input:disabled,
.field input.is-mirrored {
  background: var(--color-bg);
  color: var(--color-muted);
  cursor: not-allowed;
}
/* Readonly inputs (zip / address) — filled programmatically via 우편번호 검색.
   Visually distinct from regular inputs so the user knows not to type. */
.field input[readonly] {
  background: var(--color-bg);
  cursor: default;
}
.field input[readonly]:focus {
  box-shadow: none;
  border-color: var(--color-border);
}

.zip-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
}
.zip-search-btn {
  padding: 0 var(--space-md);
  border: 1px solid var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary-dark);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.zip-search-btn:hover {
  background: var(--color-primary);
  color: var(--color-surface);
}
.field textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9375rem;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.check-row input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.check-row small {
  color: var(--color-muted);
  font-weight: 400;
  font-size: 0.8125rem;
}
.summary-label small {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 400;
}

/* ---------- cart list (sticky summary + order page) ---------- */

.cart-list {
  list-style: none;
  margin: 0 0 var(--space-sm);
  padding: 0 0 var(--space-sm);
  border-bottom: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  /* Cap height so picking 10 things doesn't push the submit button off-screen. */
  max-height: 8rem;
  overflow-y: auto;
}
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-sm);
  align-items: baseline;
  font-size: 0.875rem;
  color: var(--color-text);
}
.cart-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-qty {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
  text-align: right;
}
.cart-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  text-align: right;
}
.cart-empty {
  color: var(--color-muted);
  font-size: 0.875rem;
  padding: var(--space-sm) 0;
  list-style: none;
}

/* Cart on the order confirmation page is allowed to grow — no scroll cap. */
.order-items-wrap .cart-list {
  max-height: none;
  overflow: visible;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}
.subsection-title {
  margin: var(--space-md) 0 var(--space-sm);
  font-size: 1rem;
  color: var(--color-primary-dark);
}

.shipping-region {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
/* D3: four across at every width. The 2x2 phone grid made the least-used
   control on the form its tallest block (121px of chips for a choice almost
   everyone leaves on 일반); minmax(0, 1fr) lets the chips shrink below their
   text instead of pushing the row wide, and the narrow tiers below pay for the
   single row in padding and type size. */
.radio-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
}
.radio-chip {
  position: relative;
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  /* Side padding is 8px, not 16px: the chip is a 1fr grid cell with centred
     text, so horizontal padding buys nothing but a narrower text box. At 16px
     도서산간 broke onto a second line in the 481-560px band and made the whole
     row twice as tall. The PC rule (>=1024px) puts the chips in a flex row
     where they ARE content-sized, and sets its own padding. */
  padding: var(--space-sm);
  background: var(--color-surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease;
}
.radio-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
/* Neither line may break: a chip that runs a pixel short would otherwise stack
   its label over two lines and drag every sibling's height with it. The sizes
   below are measured against Chromium's Korean fallback; a device font that
   sets wider degrades to an ellipsis instead of spilling out of the chip. */
.radio-chip span,
.radio-chip small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-chip span {
  font-size: 0.9375rem;
  font-weight: 600;
}
.radio-chip small {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 400;
  margin-top: 2px;
}
/* Fallback for browsers without :has(): the native radio is opacity: 0, so
   without a rule here the selected 배송 지역 has no visual indication at all.
   The input precedes the span in the markup, so the sibling combinator works
   everywhere. The :has() rules below layer the chip border/background on top. */
.radio-chip input:checked + span {
  color: var(--color-primary-dark);
  font-weight: 800;
}
.radio-chip:focus-within { box-shadow: 0 0 0 3px rgba(63, 107, 58, 0.18); }

.radio-chip:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(63, 107, 58, 0.08);
}
.radio-chip:has(input:checked) span { color: var(--color-primary-dark); }
.radio-chip:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(63, 107, 58, 0.18);
}
/* Phones: the four chips share ~290px inside the form card, so ~67px each.
   Padding first, then type — the fee stays on its own line under the label
   because inline it would set a ~100px floor per chip and force the wrap back. */
@media (max-width: 480px) {
  .radio-row { gap: 6px; }
  .radio-chip { padding: 6px 1px; border-radius: 8px; }
  .radio-chip span { font-size: 0.8125rem; letter-spacing: -0.02em; }
  .radio-chip small { font-size: 0.6875rem; margin-top: 1px; letter-spacing: -0.03em; }
}
/* Smallest phones still in use (320-360px), where 단체주문's shipment card
   insets the row another 16px per side and leaves ~50px of text box per chip.
   Measured: 도서산간 is the widest string here (4 Korean glyphs beat +5,000원's
   8 narrow ones), so the label sets the floor and drops to 11px; the fee only
   needs tighter tracking. Side padding goes to 0 — on a chip this narrow those
   2px do more for the text than for the border. */
@media (max-width: 360px) {
  .radio-row { gap: 3px; }
  .radio-chip { padding: 5px 0; }
  .radio-chip span { font-size: 0.6875rem; }
  .radio-chip small { font-size: 0.625rem; letter-spacing: -0.05em; }
}

/* ---------- payment info box ---------- */

.account-box {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: var(--space-md);
  border: 1px dashed var(--color-border);
}
.account-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}
.account-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.account-value {
  font-size: 1.125rem;
  color: var(--color-primary-dark);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.account-value-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.copy-btn {
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-primary-dark);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.copy-btn:hover {
  background: var(--color-primary);
  color: #fff;
}
.copy-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63, 107, 58, 0.18);
}
.copy-btn.is-copied {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.account-note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-muted);
  line-height: 1.55;
}
.account-note strong { color: var(--color-text); }
.account-note.expire-policy {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(217, 48, 37, 0.08);
  border-left: 3px solid #d93025;
  border-radius: 6px;
  color: #b91c1c;
}
.account-note.expire-policy strong { color: #b91c1c; }
.expired-notice {
  padding: var(--space-md);
  background: rgba(217, 48, 37, 0.08);
  border: 1px solid #d93025;
  border-radius: 8px;
  color: #b91c1c;
}
.expired-notice p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
}
.expired-notice a { color: #b91c1c; text-decoration: underline; }

/* ---------- QnA image stack (자주 묻는 질문, 결제 안내 아래) ----------
   Four assets (qna1.jpg, qna2.mp4, qna3.jpg, qna4.jpg) stacked with no gap and
   no border-radius so they read as one continuous illustration. All four are
   848px wide natively and are stretched to the column so their edges line up
   with the product grid and the order form above — up to ~1.14x at the widest
   PC column, on top of the 2x every high-DPI screen already applies. Re-export
   the four assets at ~2000px wide to make that upscale free. */
.qna-section {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-lg);
}
.qna-section img,
.qna-section video {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- sticky summary ---------- */

.summary {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-md);
  z-index: 10;
  box-shadow: var(--shadow-summary);
  /* iOS safe area */
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
}
.summary-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
/* Action row docked at the top-right inside the sticky summary bar (주문 내역
   찾기 + 카카오톡 상담) so these never float and the header page-actions stay
   to a single line on mobile. Stays visible even when the summary is collapsed. */
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}
.summary-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
.summary-link:hover { background: var(--color-bg); }
/* KakaoTalk consult button — brand colors fixed across all themes. */
.summary-kakao {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: #FEE500;
  color: #3C1E1E;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
}
.summary-kakao-icon { width: 16px; height: 16px; }
.summary-kakao:hover { filter: brightness(0.96); }
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9375rem;
  color: var(--color-muted);
}
.summary-row.total {
  padding-top: var(--space-xs);
  margin-top: var(--space-xs);
  border-top: 1px solid var(--color-border);
  font-size: 1rem;
  color: var(--color-text);
}
.summary-value {
  font-size: 1rem;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.summary-total {
  font-size: 1.375rem;
  color: var(--color-primary-dark);
  font-weight: 700;
}
/* Three pills do not fit across a phone at the default size: the row wrapped,
   which put 카카오톡 상담 on a line of its own and grew the fixed bar by 33px.
   Same treatment as the PC rail — one line, tighter type, and only the long
   first pill may shrink, so a narrow phone degrades to an ellipsis rather than
   to a second row. */
@media (max-width: 1023px) {
  .order-panel .summary-actions {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .order-panel .summary-actions > * {
    padding: 5px 7px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .order-panel .summary-actions > :first-child { flex: 0 1 auto; min-width: 0; }
  .order-panel .summary-actions > * + * { flex: 0 0 auto; }
  .order-panel .summary-kakao { gap: 3px; }
  .order-panel .summary-kakao-icon { width: 14px; height: 14px; }
}

/* ---------- summary collapse toggle (mobile UX) ----------
   A small chevron pill that sits at top-center of the summary bar so users
   can collapse the breakdown when it covers too much of the screen. When
   collapsed, only the total row + submit button remain visible. The chevron
   rotates to indicate the next action (down = collapse, up = expand). */
.summary-toggle {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 28px;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  z-index: 1;
}
.summary-toggle:hover { color: var(--color-text); }
.summary-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.summary-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 200ms ease;
}
/* Collapsed: chevron flips to point up = "tap to expand back". */
.summary.is-collapsed .summary-toggle svg { transform: rotate(180deg); }
/* Hide everything except total + submit when collapsed. */
.summary.is-collapsed #cart-list,
.summary.is-collapsed .summary-row:not(.total) { display: none; }
.summary.is-collapsed .summary-row.total {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
/* Shrink the container's bottom reserve when the summary is collapsed —
   the summary takes ~5rem instead of ~22rem, so the form doesn't need
   to leave that much breathing room below. Mirrored from JS. */

.submit-btn {
  margin-top: var(--space-sm);
  padding: 0.875rem var(--space-md);
  background: var(--color-primary);
  color: var(--color-surface);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 120ms ease;
}
.submit-hint { display: none; }
.submit-btn:hover:not(:disabled) { background: var(--color-primary-dark); }
.submit-btn:disabled {
  background: var(--color-disabled);
  cursor: not-allowed;
}

/* ---------- status messages ---------- */

.loading,
.error {
  padding: var(--space-md);
  text-align: center;
  font-size: 0.875rem;
  grid-column: 1 / -1;
}
.loading { color: var(--color-muted); }
.error { color: var(--color-accent); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  max-width: calc(100% - 2 * var(--space-md));
  padding: var(--space-sm) var(--space-md);
  background: var(--color-text);
  color: var(--color-surface);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transform: translate(-50%, calc(-100% - var(--space-md)));
  transition: transform 200ms ease;
  pointer-events: none;
}
.toast.visible {
  transform: translate(-50%, 0);
}

/* ---------- order confirmation (1.6) ---------- */

.order-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.order-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9375rem;
  color: var(--color-muted);
  padding: var(--space-sm) 0;
  border-bottom: 1px dashed var(--color-border);
}
.order-row:last-child { border-bottom: none; }
.order-row.total {
  font-size: 1rem;
  color: var(--color-text);
  border-bottom: none;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}
/* For long values like a full address that wrap onto multiple lines. */
.order-row-block {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
}
.order-row-block .order-value {
  font-weight: 600;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}
.order-value {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.order-total {
  font-size: 1.375rem;
  color: var(--color-primary-dark);
  font-weight: 700;
}
.status-badge {
  padding: 2px var(--space-sm);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.status-badge.unpaid { background: rgba(196, 74, 43, 0.12); color: var(--color-accent); }
.status-badge.paid { background: rgba(63, 107, 58, 0.14); color: var(--color-primary-dark); }
.status-badge.mismatch { background: rgba(0, 0, 0, 0.08); color: var(--color-muted); }
.status-badge.expired { background: #d93025; color: #fff; }
.status-badge.shipped { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; margin-left: 4px; }

.order-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.refresh-btn,
.back-link {
  flex: 1;
  text-align: center;
  padding: 0.75rem var(--space-md);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: background 120ms ease;
}
.refresh-btn { cursor: pointer; }
.refresh-btn:hover,
.back-link:hover { background: var(--color-bg); }
.refresh-btn.primary {
  background: var(--color-primary);
  color: var(--color-surface);
  border-color: var(--color-primary);
}
.refresh-btn.primary:hover { background: var(--color-primary-dark); }

/* ---------- wide-screen order page (>= 1024px) ----------
   Left column: hero strip, product grid, FAQ. Right column: an order rail whose
   summary card pins to the bottom of the viewport, so the total and 주문하기 are
   always reachable without the nested scrollbar this replaces.
   Scoped with the static `body.page-order` hook rather than :has(.order-panel):
   the measure can then be redeclared per page (see body.page-narrow), the
   selectors are greppable, and no rule depends on a subtree app.js rebuilds on
   every quantity tap. */
@media (min-width: 1024px) {
  /* The single knob for "use the PC screen wider". CONTENT measure — see the
     token block at the top of this file. */
  body.page-order {
    --page-max: 1440px;
    /* The 상품 선택 row: the line box of a 1.375rem title at the inherited 1.5
       line-height. Pinned as a token because the rail is offset by exactly this
       plus the row's own gap — that is what puts the cart card's top edge on the
       product grid's top edge instead of on the heading. Retune this together
       with `body.page-order .section-title` below. */
    --toolbar-h: 2.0625rem;
  }

  body.page-order main.container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    /* hero / products / order form / FAQ. The last row is the flexible one on
       purpose: the rail spans rows 2-4 and is briefly TALLER than the left
       column on first paint (the product list is still a single
       <p class="loading"> and the FAQ art has not decoded), so the surplus is
       absorbed by one track instead of opening a gap between every row. With an
       auto-height container an `1fr` row resolves to its content size, so the
       steady state is unaffected. */
    grid-template-rows: auto auto auto 1fr;
    column-gap: var(--col-gap);
    align-items: start;
    padding-top: var(--space-lg);
  }
  /* The strip spans the whole measure: products and the order form both start
     below it, so the two columns line up on one horizontal rule. */
  body.page-order main.container > .hero-grid {
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: var(--space-xl);
  }
  /* 3:2 instead of the mobile square: across the full measure a square tile
     would be ~350px tall and push the products out of the first screen again.
     object-fit: cover (see .hero-grid video) crops the 720x720 sources. */
  body.page-order main.container > .hero-grid video,
  body.page-order main.container > .hero-grid img { aspect-ratio: 3 / 2; }
  body.page-order main.container > .products { grid-column: 1; grid-row: 2; }
  body.page-order main.container > .qna-section {
    grid-column: 1;
    grid-row: 4;
    margin-top: var(--space-xl);
  }
  /* setupSummaryReserve() clears the inline reserve once the summary stops being
     `fixed`, which would otherwise fall back to the 22rem mobile reserve and
     leave ~350px of dead space at the foot of the page. Must stay inside this
     media block and stay scoped to the two order pages, or it also strips the
     pre-JS reserve from mobile. */
  body.page-order main.container.has-summary,
  body.page-group main.container.has-summary { padding-bottom: var(--space-xl); }

  /* The rail is the cart: what you picked, what it costs, the button, and the
     deposit note. Nothing else — the order form is a left-column block under the
     products, which is what keeps this card short enough to take in at a glance
     with no scrollbar of its own.
     `align-self: start` is what lets it stick — a stretched grid item is exactly
     as tall as its area and can never stick. Breaks silently if an ancestor ever
     gains overflow: hidden/auto.

     --rail-h is the card's own height, published by setupRailHeight() in app.js.
     At its normal size the calc() is positive and min() picks 16px, an ordinary
     top-pinned sidebar. It only matters when a long cart makes the card taller
     than the viewport: the calc() goes negative, the card pins by its BOTTOM
     edge, and the total, 주문하기 and the deposit note stay on screen instead of
     dropping below the fold. Without the JS the 0px fallback degrades to a plain
     top: 16px. */
  /* Appearance and stickiness are shared by both order pages; only the grid
     placement below differs. .order-panel exists solely as this rail. */
  main.container > .order-panel {
    align-self: start;
    position: sticky;
    top: min(var(--space-md), calc(100vh - var(--rail-h, 0px) - var(--space-md)));
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-surface);
    /* Heavier than a product card on purpose: this is the one panel on the page
       that has to be found without looking for it. */
    border: 1px solid rgba(63, 107, 58, 0.35);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(46, 42, 37, 0.1);
    /* Clips the footer tint to the rounded corners. Safe on the sticky element
       itself — only an ANCESTOR's overflow would break stickiness. */
    overflow: hidden;
  }
  body.page-order main.container > .order-panel {
    grid-column: 2;
    /* Skip the 상품 선택 row so the card starts level with the first product
       card, not with the heading above it. */
    margin-top: calc(var(--toolbar-h) + var(--space-sm));
    /* Rows 2-4 are the three left-column blocks it travels beside (the hero in
       row 1 spans both columns). Must be edited together with
       grid-template-rows above. (`2 / -1` would NOT future-proof it — negative
       line indices count back from the explicit grid only.) */
    grid-row: 2 / span 3;
  }
  /* The panel IS the card, so the deposit note inside it is a plain band rather
     than a second card nested in the first. */
  .order-panel .form-section {
    margin: 0;
    padding: var(--space-sm) var(--space-md) var(--space-md);
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .order-panel .section-title {
    margin: 0 0 var(--space-sm);
    font-size: 1.0625rem;
  }

  /* The order form, a left-column block under the products. It takes the full
     column so its edges line up with the product grid above it — unlike the FAQ
     below, which is capped at its artwork's native 848px. Two-up fields, because
     a single stack of inputs across this measure would be absurd. */
  body.page-order main.container > .order-panel-forms {
    grid-column: 1;
    grid-row: 3;
    margin-top: var(--space-lg);
    /* Landing point for the 주문서 작성 link in the rail. */
    scroll-margin-top: var(--space-md);
  }
  body.page-order .order-panel-forms .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* .field-wide marks the rows that need the full measure: the address block,
     the detail line and the memo. */
  body.page-order .order-panel-forms .check-row,
  body.page-order .order-panel-forms .shipping-region,
  body.page-order .order-panel-forms .field-wide { grid-column: 1 / -1; }

  /* 배송 지역 is a four-way choice that almost everyone leaves on 일반, so it
     does not get to be the biggest control on the page. Across the full column
     the 1fr-per-chip grid stretched each one to ~225px of mostly empty space;
     here they shrink to their own text on a single line, fee included. */
  body.page-order .order-panel-forms .radio-row,
  body.page-group .radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  body.page-order .order-panel-forms .radio-chip,
  body.page-group .radio-chip { padding: 6px 12px; }
  body.page-order .order-panel-forms .radio-chip span,
  body.page-group .radio-chip span { font-size: 0.875rem; }
  body.page-order .order-panel-forms .radio-chip small,
  body.page-group .radio-chip small {
    display: inline;
    margin: 0 0 0 5px;
    font-size: 0.8125em;
  }

  /* group.html: form sections on the left, the cart rail on the right. The
     measure has to carry both — 1360 leaves ~930 for the form, the same column
     the main order page gives it. */
  body.page-group { --page-max: 1360px; }
  body.page-group main.container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    grid-template-rows: auto auto;
    column-gap: var(--col-gap);
    align-items: start;
  }
  /* The lede describes the page, so it spans the measure and both columns start
     below it. .group-col wraps the remaining form sections, so the grid has
     exactly three children and no rule has to count sections. */
  body.page-group main.container > .group-lede { grid-column: 1 / -1; grid-row: 1; }
  body.page-group main.container > .group-col { grid-column: 1; grid-row: 2; }
  body.page-group main.container > .order-panel {
    grid-column: 2;
    grid-row: 2;
    /* Matches the .form-section margin inside .group-col, so the card's top edge
       lands on 주문자 정보's. */
    margin-top: var(--space-md);
  }
  body.page-group .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.page-group .check-row,
  body.page-group .shipping-region,
  body.page-group .field-wide { grid-column: 1 / -1; }

  /* The cart is the card's whole point, so it sits on the card's own surface.
     The only tinted band is the deposit note below it. */
  .order-panel > .summary {
    flex: 0 0 auto;
    position: static;
    margin: 0;
    padding: var(--space-md);
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
  .order-panel .summary-inner { max-width: none; }
  .order-panel .summary-row.total { font-size: 1.0625rem; }
  .order-panel .summary-total { font-size: 1.5rem; }
  .order-panel .submit-btn {
    padding-block: 0.8125rem;
    font-size: 1.0625rem;
  }
  /* Only wide screens split the button from the form, so only wide screens need
     to say where the form went. `[hidden]` still wins — it is !important. */
  body.page-order .order-panel .submit-hint {
    display: block;
    margin: var(--space-sm) 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--color-muted);
    text-align: center;
  }
  body.page-order .order-panel .submit-hint a {
    color: var(--color-primary-dark);
    font-weight: 700;
  }

  /* Footnote bands under 주문하기: the deposit note, and on group.html the
     bulk-order route below it. Read once, after the button — not skipped over on
     the way to the total. */
  .order-panel > .payment-info,
  .order-panel > .bulk-notice {
    padding: var(--space-sm) var(--space-md) var(--space-md);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
  }
  .order-panel > .payment-info .section-title,
  .order-panel > .bulk-notice .section-title {
    margin-bottom: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--color-muted);
  }
  /* A 400px rail is too narrow for the two buttons side by side, and the copy
     is footnote-sized here rather than section-sized. */
  .order-panel .bulk-notice p { font-size: 0.6875rem; line-height: 1.5; }
  .order-panel .bulk-hint { font-size: 0.625rem; }
  .order-panel .bulk-actions { gap: 6px; margin-bottom: var(--space-sm); }
  .order-panel .bulk-link,
  .order-panel .bulk-actions .summary-kakao {
    padding: 5px 9px;
    font-size: 0.6875rem;
  }
  /* One row, grouped at the right. Measured at the 400px rail: the three pills
     come to 328px of the 367px available. 13px type with the same padding takes
     364px — inside the measure, but with only 3px to spare, which is not enough
     for a machine that renders Korean a little wider. nowrap forbids a ragged
     second line; the long first pill is the only one allowed to shrink, so a
     narrower measure degrades to an ellipsis rather than to a second row. */
  .order-panel .summary-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: var(--space-sm);
  }
  .order-panel .summary-actions > * {
    padding: 5px 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .order-panel .summary-actions > :first-child { flex: 0 1 auto; min-width: 0; }
  .order-panel .summary-actions > * + * { flex: 0 0 auto; }
  .order-panel .summary-kakao { gap: 3px; }
  .order-panel .summary-kakao-icon { width: 13px; height: 13px; }
  .order-panel #cart-list { max-height: none; overflow: visible; }

  .order-panel .payment-info .account-note {
    font-size: 0.6875rem;
    line-height: 1.5;
  }

  /* PC album card: price, quantity and gift wrap stack full width. The
     side-by-side layout needs ~290px of card content (measured min-content:
     price 77 + gap + wrap-control 201), which a 2- or 3-up PC card never
     reaches — so stacking is the designed PC card, not a fallback, and it also
     fixes the overflow that already happens at 1024 today.
     `:not(.product-list-view)` is NOT redundant: this selector is (0,4,0) and
     would otherwise beat `.product-grid.product-list-view` (0,2,0) and shatter
     list mode. Every PC column rule below carries the same guard. */
  body.page-order .product-grid:not(.product-list-view) .product-card .product-purchase {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-sm);
  }
  body.page-order .product-grid:not(.product-list-view) .product-card .product-price,
  body.page-order .product-grid:not(.product-list-view) .product-card .qty-control,
  body.page-order .product-grid:not(.product-list-view) .product-card .wrap-control,
  body.page-order .product-grid:not(.product-list-view) .product-card .event-stock {
    grid-column: 1;
    grid-row: auto;
  }
  /* One line for the two prices now that the column is full width. */
  body.page-order .product-grid:not(.product-list-view) .product-card .product-price {
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-sm);
  }

  /* Tighter vertical rhythm above the fold: with the hero down to a strip, the
     two gaps between it and the first product row are the cheapest pixels left
     to buy back for the first screen. */
  body.page-order .products-toolbar {
    min-height: var(--toolbar-h);
    margin-bottom: var(--space-sm);
  }
  /* The 44px minimum on the toggle is a touch target — it is what made this row
     51px tall and pushed it out of line with everything else. A mouse does not
     need it, so at this breakpoint the buttons shrink to fit inside the title's
     line box and the row is exactly as tall as 상품 선택. */
  body.page-order .product-view-toggle { padding: 2px; }
  body.page-order .product-view-toggle button {
    min-width: 34px;
    min-height: 0;
    padding: 5px 10px;
    line-height: 1;
  }

  /* ---- PC chrome (all pages) ---- */
  .site-header { padding-block: var(--space-sm); }
  .event-banner-slide { min-height: 120px; padding: 22px 32px; }
  .event-banner-title { font-size: 1.5rem; }
  /* 1.125rem section titles read as a stretched phone on a 1440px canvas. */
  body.page-order .section-title { font-size: 1.375rem; }
}

/* PC drops the collapse UI entirely: the summary is a docked footer inside the
   order card, not a bar covering the screen, so the bottom-sheet chevron has
   nothing to do. These beat the .is-collapsed rules earlier in the file on
   specificity, and bindSummaryToggle() in app.js forces the expanded state at
   the same breakpoint so aria-expanded can never disagree with the screen. */
@media (min-width: 1024px) {
  .order-panel .summary-toggle { display: none; }
  .order-panel .summary.is-collapsed #cart-list,
  .order-panel .summary.is-collapsed .summary-row:not(.total) { display: flex; }
  .order-panel .summary.is-collapsed .summary-row.total {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-xs);
    padding-top: var(--space-xs);
  }
}

/* Mouse-era affordance: the card is where the steppers live, but it has no
   hover feedback at all today. */
@media (hover: hover) and (min-width: 1024px) {
  body.page-order .product-card:not(.sold-out) {
    transition: box-shadow 140ms ease, border-color 140ms ease;
  }
  body.page-order .product-card:not(.sold-out):hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  }
}

/* 3-up once a card clears ~283px of content. */
@media (min-width: 1360px) {
  body.page-order .product-grid:not(.product-list-view) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.page-order .product-grid:not(.product-list-view) .product-name {
    min-height: calc(1.35em * 2);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}

/* Only once there is room to spare — at 1024 a wider gutter would make the left
   column narrower than it is today. */
@media (min-width: 1440px) {
  body.page-order { --page-gutter: var(--space-xl); }
}

/* Once the left column can still hold three cards, give the rail the extra
   room — it is what makes the two-up fields comfortable rather than merely
   legible. */
@media (min-width: 1600px) {
  body.page-order { --rail-w: 440px; }
}

.container-narrow {
  /* Same 520px box as before, expressed as a content measure so the band rule
     produces it (see the token block at the top of this file). */
  --page-max: calc(520px - 2 * var(--page-gutter));
  padding-bottom: var(--space-xl);
}
/* order.html / find.html: the shell bands are siblings of <main>, so they need
   the narrow measure on <body> as well as on the container itself. */
body.page-narrow {
  --page-max: calc(520px - 2 * var(--page-gutter));
}

/* ---------- wide-screen read-only pages (order.html / find.html) ----------
   A 520px ribbon on a 1440px screen is the same "stretched phone" problem the
   order page had. Widen the measure and split the cards into two columns. */
@media (min-width: 1024px) {
  body.page-narrow { --page-max: 880px; }
  body.page-narrow .container-narrow { --page-max: 880px; }

  /* order.html — the order itself on the left, logistics and payment stacked on
     the right. Every cell is placed explicitly: with auto-placement the tall
     order card defines row 1, which opened a dead gap above 입금 안내. The last
     row takes the slack instead, and align-items: start keeps each card at the
     top of its row. Hidden sections are display:none, so their row collapses to
     zero and the cards below simply move up. */
  body.page-detail main.container {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: var(--space-xl);
    align-items: start;
  }
  body.page-detail #token-expired { grid-column: 1 / -1; grid-row: 1; margin: 0 0 var(--space-md); }
  body.page-detail main.container > section:first-of-type { grid-column: 1; grid-row: 2 / -1; }
  body.page-detail #o-tracking-section { grid-column: 2; grid-row: 2; }
  body.page-detail #o-shipping-section { grid-column: 2; grid-row: 3; }
  body.page-detail #payment-info-section { grid-column: 2; grid-row: 4; }
  body.page-detail .form-section { margin: 0 0 var(--space-md); }

  /* find.html — the lookup card spans the measure like every other band, with
     its three fields and the button on one row. The result cards stay one per
     row (the base .order-card-list) and use the width inside the card. */
  body.page-find #find-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.7fr) auto;
    align-items: end;
  }
  /* The margin exists to separate the button from a stack of fields above it;
     on one row it would push the button below the inputs' baseline. */
  body.page-find #find-submit { margin-top: 0; }
}

/* ---------- KakaoTalk channel FAB ---------- */
.kakao-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: block;
  z-index: 50;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.kakao-fab:hover,
.kakao-fab:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  outline: none;
}
.kakao-fab-icon { display: block; width: 100%; height: 100%; }

/* ---------- tracking link (order page + find cards) ---------- */
.tracking-link {
  color: var(--color-primary-dark);
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}
.tracking-link:hover { text-decoration: underline; }

/* ---------- token expired banner (order.html) ---------- */
.token-expired {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  background: rgba(196, 74, 43, 0.06);
  border-radius: var(--radius);
}
.token-expired p { margin: 0 0 var(--space-sm); color: var(--color-text); }

/* ---------- find page ---------- */
.hint-text {
  margin: 0 0 var(--space-md);
  color: var(--color-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.order-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.order-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.order-card-date {
  font-size: 0.875rem;
  color: var(--color-muted);
}
.order-card-status { display: flex; gap: 4px; flex-wrap: wrap; }
.order-card-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.order-card-items li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: 0.9375rem;
  color: var(--color-text);
  padding: 2px 0;
}
.order-card-item-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.order-card-item-qty {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.order-card-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--color-border);
}
.order-card-summary {
  font-size: 0.9375rem;
  color: var(--color-muted);
  flex: 1;
  min-width: 0;
}
.order-card-total {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}
.order-card-tracking {
  font-size: 0.9375rem;
  color: var(--color-text);
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--color-border);
}
.order-card-actions { display: flex; justify-content: flex-end; }

/* Generic button used on find result cards and token-expired CTA. */
.btn {
  display: inline-block;
  padding: 0.625rem var(--space-md);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn:hover { background: var(--color-bg); }
.btn.primary {
  background: var(--color-primary);
  color: var(--color-surface);
  border-color: var(--color-primary);
}
.btn.primary:hover { background: var(--color-primary-dark); }
