/* =========================================================
   디자인 값 — 색, 글꼴, 모서리, 여백, 효과 속도는 여기서만 바꾸면 돼요
   ========================================================= */
:root {
  /* ── 색상 ── */
  --color-page: #FFFFFF;          /* 페이지 전체 바탕 (위 영역 뒤). 2026-11-23 사용자 요청으로 베이지(#F4F1EC) → 흰색.
                                     예전 '카드 창' 모습(베이지 바탕 + 카드 그림자)은 CONFIG.PREVIEW_FRAME: true 로 되살림 (아래 :root.is-framed) */
  --color-surface: #FFFFFF;       /* 아래 영역, 주문 창 바탕 */
  --color-preview: #FFFFFF;       /* 미리보기 칸 바탕 = 선택된 탭 바탕 (같아야 이어져 보임) */
  --color-tab: #E8E3DB;           /* 선택 안 된 탭, 제품군 버튼 줄 바탕 */
  --color-text: #1F1D1A;          /* 기본 글자 */
  --color-text-soft: #625C54;     /* 보조 글자 (설명, 라벨). 흰 바탕·탭 바탕 모두 대비 기준(4.5:1) 이상 */
  --color-text-faint: #7A736A;    /* 흐린 글자 (가격, 요약 항목명). 흰 바탕 대비 4.5:1 이상 → 야외 햇빛에서도 읽힘 */
  --color-line: #E7E2DA;          /* 구분선, 입력칸 테두리 */
  --color-accent: #1F1D1A;        /* 선택 테두리, 체크, 주문 버튼 */
  --color-accent-text: #FFFFFF;   /* 주문 버튼 글자 */
  --color-cta: #94BEDD;           /* 둘러보기 '꾸미기 시작' 버튼 바탕 (브랜드 하늘색, 사용자가 정함) */
  --color-cta-text: #7C5941;      /* 그 버튼 글자 (브랜드 갈색, 로고 글자색과 같음) */
  --color-dot-biz: #9C9A95;        /* 둘러보기 오른쪽 마름모(판매자 정보 자리): 디자인 점보다 조금 진한 회색 (하늘색은 '너무 특별', 옅은 회색은 '차이가 안 느껴진다'는 지적) */
  --color-dot-biz-active: #5C5A57; /* 그 마름모가 선택됐을 때: 검정이 아니라 조금 더 진한 회색 */
  --color-focus: #2F6FED;         /* 키보드로 이동할 때 보이는 테두리 */
  --color-danger: #C2410C;        /* 오류 안내, 품절 (흰 바탕 대비 4.5:1 이상) */
  --color-draft: #DC2626;         /* 고지 문구 중 아직 정하지 않은 가안([[ ]]) 표시 */
  --color-success: #2F9E44;       /* 완료 표시 */
  --color-skeleton: #ECE7DF;      /* 불러오는 중 회색 블록 */
  --color-backdrop: rgba(24, 22, 19, .42); /* 주문 창 뒤 어두운 막 */
  --color-brand-ink: #7C5941;     /* feno 로고 글자 갈색 (라벨 그대로) */
  --color-intro-bg: #95ADBF;      /* 첫 화면 털 바탕의 평균 색 (바탕 그림이 오기 전·못 받았을 때). 그림은 images/brand/label-bg.jpg (.claude/make-brand.py) */
  --mirror-1: #E9EEF1;            /* 거울 은빛 (밝은 쪽 → 어두운 쪽 순서) */
  --mirror-2: #CFD9DF;
  --mirror-3: #DFE6EA;
  --mirror-4: #B9C6CD;
  --photo-mat: #EFEAE2;            /* 액자 안쪽: 사진 뒤 받침 종이 색 */
  --film-ratio: 3;                 /* 액자 예시 사진(인생네컷)의 세로 ÷ 가로 */
  --film-paper: #FFFFFF;           /* 인생네컷 사진 테두리 색 */
  --film-person: rgba(60, 52, 46, .55);   /* 사진 속 사람 실루엣 */
  --film-bg-1: #F6D9CF;            /* 사진 네 칸 바탕 색 (위 → 아래) */
  --film-bg-2: #DCE7F3;
  --film-bg-3: #F3E7C9;
  --film-bg-4: #DCEBDD;
  --film-logo: #E7E2DA;            /* 사진 아래 로고 자리 */

  /* ── 글꼴 ── */
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-size-xs: 12px;           /* 선택지 가격, 작은 안내 (야외에서 읽히도록 12px 이상) */
  --font-size-sm: 13px;           /* 탭 이름, 선택지 이름, 요약 */
  --font-size-md: 15px;           /* 본문, 버튼 */
  --font-size-lg: 17px;           /* 주문 창 제목 */
  --font-size-xl: 22px;           /* 총 금액 */
  --font-size-input: 16px;        /* 입력칸 (16px 미만이면 아이폰이 화면을 확대함) */
  --font-size-brand: 18px;        /* 머리줄 왼쪽 마켓 이름 */
  --brand-logo-height: 29px;      /* 머리줄 feno 로고 글자 높이 (첫 화면 로고가 작아지며 정확히 여기에 앉음). 2026-11-23 사용자 요청으로 24px의 120% */
  --intro-logo-width: min(38vw, 182px);   /* 첫 화면 연출의 큰 feno 로고 폭. 예전 58vw·280px은 '너무 크다'는 지적 → 65% */
  --intro-tagline-width: calc(var(--intro-logo-width) * 1.6);   /* 아래 한 줄 소개(for a softer home) 칸 폭 = 로고의 1.6배 (예전 그림 연출과 같음) */
  --font-size-slide: 28px;        /* 둘러보기의 디자인 이름 */

  /* ── 모서리 둥글기 ── */
  --radius-lg: 22px;              /* 미리보기 칸(왼쪽), 아래 영역, 주문 창 */
  --radius-preview-tab-side: var(--radius-lg); /* 미리보기 칸의 탭 쪽(오른쪽) 모서리. 둘러보기 카드·왼쪽 모서리와 같은 둥글기여야 함:
                                    둘러보기 ↔ 꾸미기 전환 중 카드 모서리 모양이 바뀌면(예전 22px ↔ 10·12px) 탭이 나오기 한참 전·들어간 뒤에
                                    모서리에 조각이 덧대졌다 사라지는 것처럼 보였음 (사용자 지적). 모서리 모양은 탭이 나오면서만 바뀜 */
  --radius-md: 14px;              /* 선택지 색 견본, 입력칸 */
  --radius-sm: 10px;              /* 탭 */
  --radius-pill: 999px;           /* 버튼 */

  /* ── 여백과 크기 ── */
  --gutter: 16px;                 /* 화면 좌우 여백 */
  --gap: 12px;                    /* 덩어리 사이 간격 */
  --max-width: 480px;             /* 데스크톱에서 최대 폭 */
  /* 미리보기 크기: 평소엔 화면 폭에 맞추고, 화면이 낮으면 나머지(사이즈 줄·색 팔레트·금액)가 한 화면에 들어오도록 줄임
     svh = 브라우저 툴바가 펼쳐진 상태의 화면 높이 → 스크롤로 툴바가 접혔다 펴져도 크기가 출렁이지 않음 */
  --palette-rows: 3;              /* 색 팔레트 줄 수 (JS 가 색 수 ÷ columns 로 다시 넣음. 이건 그 전의 기본값) */
  --palette-cell: 42px;           /* 색 팔레트 한 칸 크기 (JS fitPalette 가 화면 폭에 맞춰 다시 넣음) */
  --palette-height: calc(var(--palette-rows) * var(--palette-cell));
  /* 미리보기를 뺀 나머지 높이 = 고정 부분(머리줄·사이즈 줄·옵션 이름·금액 바 등, .claude/layout-check.js 로 잰 값) + 팔레트 높이
     값이 크면 미리보기가 작아짐 */
  --layout-rest: calc(241px + var(--palette-height));
  --preview-min-size: 200px;      /* 화면이 아주 낮아도 미리보기는 이 크기 이상 */
  --preview-max: max(var(--preview-min-size), calc(100svh - var(--layout-rest)));
  --tab-width: 54px;              /* 오른쪽 탭 폭 */
  --tab-pop: 8px;                 /* 선택된 탭이 왼쪽으로 나와 미리보기 칸에 붙는 거리 (= 선택 안 된 탭과 미리보기 칸 사이 틈) */
  --tab-gap: 5px;                 /* 탭 사이 간격 */
  --tab-max-height: 64px;         /* 탭 높이 (탭이 적을 때). 탭이 많아지면 미리보기 높이를 꽉 채우도록 자동으로 나눔 */
  --tab-min-height: 28px;         /* 탭 최소 높이. 탭이 많으면 여기까지 줄어 한눈에 보이고, 그래도 넘칠 때만 세로 스크롤 */
  --tab-fillet: 8px;              /* 선택된 탭과 미리보기 칸이 만나는 위·아래 오목한 이음매 크기 */
  --choice-width: 72px;           /* 선택지 한 칸 폭 */
  --choice-size: 52px;            /* 선택지 색 견본 크기 */
  --option-body-height: 132px;    /* 선택지 영역 높이 (탭마다 높이가 달라 화면이 출렁이지 않게 고정) */
  --topbar-height: 44px;          /* 맨 위 머리줄(가게 이름, 내 주문, 장바구니) 높이 */
  --bar-btn-size: 52px;           /* 주문 바의 담기·취소 버튼 폭 (작은 네모) */
  --order-btn-width: 140px;       /* 주문 버튼 폭 (화면이 좁으면 이보다 줄어듦) */
  --wide-max-width: 1000px;       /* 좌우 배치(가로 화면·폴드 펼침)일 때 전체 최대 폭 */
  /* 둘러보기의 디자인 그림 크기: 화면 폭(오른쪽 점 자리 빼고) / 화면 높이(이름·설명·버튼 자리 빼고) / 최대 중 작은 것 */
  --slide-visual: min(calc(100vw - 2 * var(--gutter) - 32px), calc(100svh - var(--topbar-height) - 300px), 460px);
  --slide-bottom-space: 88px;                  /* 둘러보기 한 장의 아래 여백: 키우면 그림·이름·버튼이 함께 위로 올라감 */
  --wide-panel-min: 320px;        /* 좌우 배치일 때 오른쪽(선택·주문) 영역 최소 폭. 크면 미리보기가 작아짐 */
  --wide-preview-cap: 520px;      /* 좌우 배치일 때 미리보기 최대 크기 */
  --choice-grid-min: 64px;        /* 폴드 펼침·태블릿 가로에서 선택지를 여러 줄로 놓을 때 한 칸 최소 폭 */
  --palette-cell-max: 48px;       /* 색 팔레트 한 칸 최대 크기 (넓은 화면에서 이보다 커지지 않음) */
  --palette-cell-min: 40px;       /* 색 팔레트 한 칸 최소 크기 (이보다 작아질 바엔 옆으로 넘김. 손가락으로 누르기 쉬운 크기) */
  --palette-cell-pad: 3px;        /* 색 팔레트 칸 사이 틈의 절반 (선택 테두리가 이 틈을 씀) */
  --palette-radius: 8px;          /* 색 팔레트 칸 모서리 */
  --pick-dot-size: 16px;          /* 옵션 이름 옆 '고른 색' 점 크기 */
  --zoom-btn-size: 32px;          /* 미리보기 왼쪽 위 '크게 보기' 버튼 크기 */
  --zoom-btn-inset: 8px;          /* 그 버튼과 미리보기 모서리 사이 */
  /* 크게 보기 카드 크기: 좌우 여백 안 가득, 낮은 화면이면 위아래 줄을 뺀 높이에 맞춤 */
  --viewer-bar: 56px;             /* 크게 보기 위(이름·닫기)와 아래(안내·원래 크기) 줄 높이 (낮을수록 그림 칸이 위아래로 길어짐) */
  --viewer-max-width: 760px;      /* 크게 보기 그림 칸의 최대 폭 (넓은 화면에서 카드가 끝없이 넓어지지 않게) */
  --viewer-land-width: min(100vw - 2 * 150px, 640px);   /* 폰 가로에서 크게 보기 카드 폭 (양옆에 이름·닫기 자리를 남김) */
  --viewer-backdrop: rgba(240, 236, 229, .78);   /* 크게 보기 바탕: 뒤 화면이 흐리게 비치는 베이지 */
  --viewer-hint-bg: rgba(31, 29, 26, .78);       /* 크게 보기 안내 알약 바탕 */
  --shadow-viewer: 0 24px 60px rgba(31, 29, 26, .16), 0 4px 12px rgba(31, 29, 26, .06);   /* 크게 보기 카드 그림자 */
  --pick-bump-scale: 1.35;        /* 색을 고를 때 그 점이 튀는 정도 */
  --thumb-size: 56px;             /* 장바구니·완료·내 주문의 상품 썸네일 크기 */
  --spec-dim: .35;                /* 규격 장을 보는 동안 꾸미기 부분(탭·사이즈·색)의 투명도 (멈춰 있다는 표시) */
  --spec-shape: #EFEBE5;          /* 규격 장의 제품 실루엣 색 */
  --spec-line: #8C857B;           /* 규격 장의 치수 선·사진 자리 점선 색 */
  --spec-dim-gap: 7px;            /* 규격 장 치수 선과 제품 가장자리 사이 (가로·세로 같은 거리) */
  --spec-dim-tick: 9px;           /* 치수 선 양 끝 가로대 길이 */
  --spec-dim-line: 1.5px;         /* 치수 선 굵기 */

  /* ── 그림자 ── */
  --shadow-preview: none;         /* 미리보기 칸 그림자. 선택된 탭과 한 몸처럼 이어져야 해서 없음 (넣으면 탭과 만나는 곳에서 끊겨 보임) */
  --shadow-panel: 0 -1px 0 rgba(31, 29, 26, .04), 0 -8px 32px rgba(31, 29, 26, .06);
  --shadow-raised: 0 1px 3px rgba(31, 29, 26, .12);
  --shadow-sheet: 0 -12px 48px rgba(31, 29, 26, .2);
  --shadow-card: 0 8px 28px rgba(31, 29, 26, .22);   /* 주문 바 위에 뜨는 담은 상품 카드 */
  --shadow-card-soft: none;       /* 둘러보기의 디자인 카드 그림자. 지금은 없음(사용자 요청: 흰 바탕에 창 테두리·음영 없이).
                                     예전 값 0 10px 34px rgba(31, 29, 26, .07) → CONFIG.PREVIEW_FRAME: true 면 아래 :root.is-framed 가 되살림 */

  /* ── 효과 (속도와 강도) ── */
  --ease-out: cubic-bezier(.22, 1, .36, 1);       /* 빠르게 시작해 부드럽게 멈춤 */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1); /* 살짝 튕기며 멈춤 (체크 표시) */
  --ease-in: cubic-bezier(.4, 0, 1, 1);           /* 천천히 시작해 빠르게 사라짐 (퇴장) */
  --ease-fly: cubic-bezier(.5, 0, .2, 1);         /* 담기: 처음엔 머뭇거리다 버튼으로 쏙 들어감 */
  --ease-glide: cubic-bezier(.7, 0, .2, 1);       /* 첫 화면: 로고가 천천히 출발해 미끄러지듯 제자리에 안착 */
  --ease-fade: cubic-bezier(.45, 0, .55, 1);      /* 첫 화면 바탕: 부드럽게 옅어지기 시작해 부드럽게 끝남 (툭 사라지지 않게) */
  --dur-press: 90ms;              /* 누를 때 눌리는 속도 */
  --dur-select: 180ms;            /* 선택 테두리·체크가 나타나는 속도 */
  --dur-tab: 240ms;               /* 탭 튀어나옴, 색 전환 */
  --dur-panel: 220ms;             /* 탭 바꿀 때 선택지 등장 */
  --dur-layer: 200ms;             /* 미리보기 레이어 교체 */
  --dur-group: 280ms;             /* 제품군 전환: 새 제품 등장, 버튼 표시 이동 */
  --dur-group-out: 130ms;         /* 제품군 전환: 이전 제품이 사라지는 시간 (다 사라진 뒤 새 제품 등장 → 겹쳐 보이지 않음) */
  --dur-price: 360ms;             /* 총 금액 숫자 굴러가기 + 강조 */
  --dur-sheet: 320ms;             /* 주문 창 열고 닫기 */
  --dur-nudge: 400ms;             /* 동의 없이 보내려 할 때 동의 줄이 흔들리는 시간 */
  --dur-fly: 560ms;               /* 담기: 상품이 담기 버튼으로 날아 들어가는 시간 */
  --dur-flash: 900ms;             /* 장바구니에서 방금 고친 상품이 잠깐 강조되는 시간 */
  --dur-hint: 900ms;              /* 옆으로 더 있는 선택지 줄이 처음 한 번 살짝 밀렸다 돌아오는 시간 */
  --hint-delay: 450ms;            /* 위 효과가 시작되기까지 (선택지가 나타난 뒤) */
  --ease-view: cubic-bezier(.32, .72, 0, 1);      /* 둘러보기 ↔ 꾸미기: 크게 움직이되 끝에서 길게 부드럽게 멈춤 */
  --dur-view: 620ms;              /* 둘러보기 ↔ 꾸미기: 그림이 날아가 앉고 선택 창이 올라오는 시간 */
  --dur-view-out: 300ms;          /* 둘러보기 ↔ 꾸미기: 떠나는 화면의 글자·창이 빠지는 시간 */
  --view-stagger: 45ms;           /* 둘러보기 → 꾸미기: 선택 창·탭·사이즈 줄이 차례로 들어오는 간격 */
  --view-late: 140ms;             /* 꾸미기 → 둘러보기: 꾸미기 화면이 빠진 뒤 둘러보기 글자가 들어오기까지 */
  --tab-hide-depth: 32px;         /* 전환 때 탭이 숨어 있는 깊이: 탭 끝이 미리보기 가장자리보다 이만큼(+2px) 안쪽에서 출발
                                     → 가장자리를 넘을 때는 이미 속도가 붙어 있어서, 탭 모서리만 먼저 걸려 보이지 않음 (얕으면 천천히 출발하는 탭 끝이 가장자리에 먼저 보였음) */
  --view-tab-delay: 490ms;        /* 둘러보기 → 꾸미기: 탭이 미리보기 뒤에서 움직이기 시작하기까지 (그 전에는 숨김).
                                     탭 끝이 둥근 모서리 틈에 처음 보이는 건 약 0.11초 뒤 = 그림이 완전히 앉은 때(약 0.6초)
                                     (더 이르면 덜 앉은 그림의 윗변과 탭 윗변이 0.3px쯤 어긋나 작은 턱이 보였음) */
  --dur-view-tab: 440ms;          /* 둘러보기 → 꾸미기: 탭이 미리보기 뒤에서 오른쪽으로 나오는 시간 (숨은 채 움직이는 처음 부분 포함) */
  --dur-view-tab-out: 260ms;      /* 꾸미기 → 둘러보기: 탭이 미리보기 뒤로 들어가는 시간 (숨은 채 움직이는 끝부분 포함) */
  --view-fly-delay: 140ms;       /* 꾸미기 → 둘러보기: 탭이 미리보기 뒤로 다 숨은 때 그림이 날아가기 시작 (나머지는 숨은 채라 기다리지 않음) */
  --ease-view-tab: cubic-bezier(.4, 0, .2, 1);    /* 전환 때 탭이 미리보기 뒤에서 드나드는 속도: 부드럽게 시작하고 멈춤 (가장자리를 지나는 건 가운데 빠른 구간) */
  --dur-morph-fade: 160ms;        /* 날아간 그림 복사본이 진짜 그림과 겹친 채 옅어지는 시간 (모서리 모양 차이가 툭 바뀌지 않게) */
  --dur-intro-in: 420ms;          /* 첫 화면: 로고가 떠오르는 시간 (한 줄 소개는 --intro-stagger 뒤에 따라옴) */
  --intro-stagger: 80ms;          /* 첫 화면: 로고 다음 한 줄 소개가 따라 나오기까지 */
  --dur-intro-photo: 300ms;       /* 첫 화면: 털 바탕 그림이 받아지면 같은 색 단색 위로 스며드는 시간 */
  --dur-intro-out: 720ms;         /* 첫 화면: 로고가 작아지며 머리줄 왼쪽 위 자리로 들어가는 시간 (한 줄 소개는 이 0.4배 동안 사라짐) */
  --dur-intro-bg-out: 1000ms;     /* 첫 화면: 털 바탕이 천천히 투명해지며 뒤 화면이 드러나는 시간 (로고가 떠날 때부터. 짧으면 '갑자기 사라진다'는 지적) */
  --dur-viewer: 340ms;            /* 크게 보기: 미리보기 자리에서 화면 가득으로 커지고 줄어드는 시간 */
  --dur-zoom-settle: 260ms;       /* 크게 보기: 손을 떼거나 두 번 눌렀을 때 배율·위치가 맞춰지는 시간 */
  --press-scale: .94;            /* 눌렀을 때 줄어드는 정도 (1이면 효과 없음) */
  --panel-shift: 10px;            /* 선택지 등장 시 미끄러지는 거리 */
  --price-bump-scale: 1.08;       /* 총 금액 강조 시 커지는 정도 */
  --count-bump-scale: 1.3;        /* 담기 개수가 바뀔 때 커지는 정도 */
}

/* '카드 창' 모습 되살리기 (CONFIG.PREVIEW_FRAME: true → <html class="is-framed">)
   2026-11-23 까지의 모습: 베이지 바탕 위에 흰 카드(둘러보기 그림·꾸미기 미리보기)가 떠 있고 둘러보기 카드엔 옅은 그림자.
   카드의 '테두리'는 선이 아니라 베이지 바탕과 흰 카드의 색 차이로 보이던 것 */
:root.is-framed {
  --color-page: #F4F1EC;
  --shadow-card-soft: 0 10px 34px rgba(31, 29, 26, .07);
}

/* 세로가 긴 폰에서는 선택지를 조금 크게 */
@media (min-height: 760px) {
  :root {
    --choice-width: 78px;
    --choice-size: 58px;
    --option-body-height: 144px;
  }
}

/* 기기에서 '동작 줄이기'를 켰으면 효과를 끔 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-press: 0ms;
    --dur-select: 0ms;
    --dur-tab: 0ms;
    --dur-panel: 0ms;
    --dur-layer: 0ms;
    --dur-group: 0ms;
    --dur-group-out: 0ms;
    --dur-price: 0ms;
    --dur-sheet: 0ms;
    --dur-viewer: 0ms;
    --dur-zoom-settle: 0ms;
    --dur-nudge: 0ms;
    --dur-fly: 0ms;
    --dur-flash: 0ms;
    --dur-hint: 0ms;
    --hint-delay: 0ms;
    --dur-view: 0ms;
    --dur-view-out: 0ms;
    --view-stagger: 0ms;
    --view-late: 0ms;
    --view-tab-delay: 0ms;
    --dur-view-tab: 0ms;
    --dur-view-tab-out: 0ms;
    --view-fly-delay: 0ms;
    --dur-morph-fade: 0ms;
    --dur-intro-in: 0ms;
    --intro-stagger: 0ms;
    --dur-intro-photo: 0ms;
    --dur-intro-out: 0ms;
    --dur-intro-bg-out: 0ms;
    --press-scale: 1;
    --panel-shift: 0px;
    --price-bump-scale: 1;
    --count-bump-scale: 1;
  }
}


/* =========================================================
   기본
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

/* 화면 확대(두 손가락 늘리기·두 번 눌러 확대)를 모든 요소에서 막음. 제품 확대는 '크게 보기'에서
   html 에만 걸면 안 됨: 브라우저는 이 값을 '가장 가까운 스크롤 영역'까지만 이어서 따져서,
   옆으로 넘기는 사이즈 줄·색표 안(특히 버튼 사이 빈틈)에서는 다시 확대가 됐음 (사용자 지적)
   (탭 열 pan-y, 크게 보기·주소 찾기 제목 줄 none 처럼 따로 정한 곳은 그 값이 우선) */
* { touch-action: pan-x pan-y; }
/* ::before/::after 는 * 에 안 걸려 기본값(auto)으로 남음 → 아이폰은 그 그림 영역(미리보기 둘레 장식 등)을
   두 번 누르면 살짝 확대했음 (사용자 지적, 2026-11-24). 각 요소의 값을 그대로 물려받게 함 */
*::before, *::after { touch-action: inherit; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: only light;                   /* 브라우저가 강제로 다크 모드(색 반전)를 걸지 않게 → 제품 색이 그대로 보임 */
  /* 당겨서 새로고침·고무줄 튕김 없음: 이 사이트는 새로고침할 내용이 없고(고른 것은 저장돼 있음),
     화면을 쓸다가 실수로 새로고침되면 효과가 처음부터 다시 나와 어수선함 */
  overscroll-behavior: none;
  background: var(--color-page);
}
body { overscroll-behavior: none; }
/* 주문 창·주소 찾기가 열려 있는 동안 뒤 페이지 고정. overscroll-behavior: none 은 아이폰에서 페이지 전체가
   고무줄처럼 튕기는(바운스) 것까지 막음 → 창 안을 쓸 때 뒤 화면이 같이 움직이거나 창이 떨리지 않게 */
html.is-locked, html.is-locked body { overflow: hidden; overscroll-behavior: none; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: 1.45;
  color: var(--color-text);
  background: var(--color-page);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { -webkit-user-drag: none; user-select: none; }
[hidden] { display: none !important; }

/* 길게 눌러도 '이미지 저장' 메뉴나 글자 선택이 뜨지 않게 (조작하는 부분만. 입력칸·주문 내용은 그대로 선택 가능) */
.topbar, .preview, .tab, .choice, .group-btn, .btn, .total, .summary, .option-head, .text-tools, .order-item-tools, .order-extra, .added-card {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
button img { pointer-events: none; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
/* 창을 열 때 화면 읽기 프로그램용으로 제목에 주는 초점(tabindex="-1")은 테두리를 그리지 않음
   (브라우저가 상황에 따라 '주문 정보' 같은 제목에 파란 박스를 그려 글씨가 선택된 것처럼 보였음) */
.sheet-title:focus, .sheet-title:focus-visible { outline: none; }

.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;
}

.app {
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  overflow-x: clip;                           /* 어떤 요소도 화면을 가로로 밀어내지 못하게 */
}


/* =========================================================
   머리줄: 가게 이름 | 내 주문 · 장바구니
   ========================================================= */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--topbar-height);
  padding: 0 calc(max(var(--gutter), env(safe-area-inset-right)) - 10px) 0 max(var(--gutter), env(safe-area-inset-left));
}
/* 가게 이름: 둘러보기에서는 왼쪽 여백에 붙고, 꾸미기 화면에서는 머리줄 가운데로 미끄러져 감
   (가운데까지의 거리 --title-center 는 JS fitTitle 이 재서 넣음. 오른쪽 버튼·‹ 뒤로와 겹치지 않게 줄여서) */
.topbar-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 auto 0 0;
  font-size: var(--font-size-brand);
  font-weight: 800;
  line-height: 1.2;                           /* 첫 화면 마켓 이름과 같아야 작아지며 정확히 이 자리에 겹침 */
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: translate var(--dur-view) var(--ease-glide);
}
/* ‹ 뒤로 (꾸미기 화면에서만): 머리줄 왼쪽 끝에 겹쳐 놓음 (자리를 차지하지 않아 둘러보기에서 이름이 왼쪽에 붙음)
   .topbar 를 붙인 이유: 뒤에 나오는 .icon-btn 의 position: relative 가 덮어써서, 숨어 있는 동안에도 44px 자리를 차지해 이름이 밀려 있었음 */
.topbar .back-btn {
  position: absolute;
  top: 0;
  left: calc(max(var(--gutter), env(safe-area-inset-left)) - 13px);
  opacity: 0;
  translate: -8px 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-select) var(--ease-out), translate var(--dur-view) var(--ease-glide), visibility 0s linear var(--dur-select);
}
.back-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.app[data-view="custom"] .back-btn {
  opacity: 1;
  translate: 0 0;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.app[data-view="custom"] .topbar-title { translate: var(--title-center, 0px) 0; }
.icon-btn {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: transform var(--dur-press) var(--ease-out);
}
.icon-btn:active { transform: scale(var(--press-scale)); }

/* '내 주문': 영수증 아이콘만으로는 뜻이 잘 안 와닿아서 이름을 붙인 작은 알약 모양 (주문한 적이 있을 때만) */
.orders-anchor { position: relative; display: flex; }
.pill-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  margin: 6px 2px;                            /* 누르는 범위는 위아래로 넓혀 44px */
  padding: 0 11px 0 9px;
  border-radius: var(--radius-pill);
  background: var(--color-tab);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur-press) var(--ease-out);
}
.pill-btn::after { content: ""; position: absolute; inset: -6px 0; }
.pill-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill-btn:active { transform: scale(var(--press-scale)); }
#myOrdersBtn { animation: pop-in var(--dur-sheet) var(--ease-out) backwards; }   /* 첫 주문 뒤 나타날 때 */
#myOrdersBtn[data-bump="a"] { animation: bump-a var(--dur-price) var(--ease-out); }   /* 주문서가 들어오면 살짝 튐 */
#myOrdersBtn[data-bump="b"] { animation: bump-b var(--dur-price) var(--ease-out); }

/* 첫 주문 뒤 한 번만 '내 주문' 아래에 뜨는 말풍선 */
.hint-bubble {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  z-index: 4;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-accent-text);
  box-shadow: var(--shadow-card);
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--dur-select) var(--ease-out), transform var(--dur-select) var(--ease-out);
}
.hint-bubble::before {                        /* 위쪽 꼬리: '내 주문' 가운데를 가리킴 */
  content: "";
  position: absolute;
  bottom: 100%;
  right: 38px;
  border: 6px solid transparent;
  border-bottom-color: var(--color-accent);
}
.hint-bubble.is-visible { opacity: 1; transform: none; }

/* 주문서 효과: 완료 창에서 작은 영수증이 '내 주문'으로 날아 들어감 (위치는 JS가 --fly-x/y/scale 로) */
.fly-receipt {
  position: fixed;
  z-index: 12;                                /* 내려가는 주문 창보다 위 */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding-top: 12px;
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  animation: fly-to-cart var(--dur-fly) var(--ease-fly) forwards;
}
.fly-receipt::after {                         /* 영수증 줄 */
  content: "";
  width: 60%;
  height: 26px;
  background: repeating-linear-gradient(to bottom, var(--color-line) 0 3px, transparent 3px 8px);
}


/* =========================================================
   첫 화면 브랜드 연출 (이 탭에서 처음 들어왔을 때만, <html class="show-intro">)
   털 질감 라벨 바탕 위에 feno 로고 + 한 줄 소개가 떠오름 → 준비되면 한 줄 소개는 사라지고,
   로고 'feno'만 작아지며 머리줄 왼쪽 위 로고 자리로 들어가고(FLIP), 바탕은 그때부터 천천히 투명해짐.
   크기·움직임은 예전 그림(png) 연출과 같고, 글자는 라벨 SVG 의 path(<symbol id="feno-word">)라 어느 해상도에서도 선명함.
   ========================================================= */
.brand-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.topbar-title .brand-logo {
  display: block;
  height: var(--brand-logo-height);
  width: auto;
  aspect-ratio: 58.18 / 36.81;                /* 로고 글자 칸의 비율 (사파리가 width: auto 를 못 정할 때 대비) */
  color: var(--color-brand-ink);
  fill: currentColor;
}
/* 가게 이름 글자는 화면 읽기 프로그램용으로만 (보이는 건 로고) */
.topbar-title .brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.intro { display: none; }
/* 연출 중에는 페이지 바탕도 같은 색 → 연출 층이 그려지기 전 첫 순간에도 흰 화면이 번쩍이지 않음 */
html.show-intro { background: var(--color-intro-bg); }
.show-intro .intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}
.show-intro .topbar-title { visibility: hidden; }   /* 연출 중에는 진짜 자리를 비워 둠 (로고가 그리로 들어감) */
.intro-bg { position: absolute; inset: 0; background: var(--color-intro-bg); }
/* 라벨 바탕 그림(글자 뺀 것)을 화면 가득. 받아진 뒤에(intro-photo) 스며듦, 못 받으면 같은 색 단색 그대로 */
.intro-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("images/brand/label-bg.jpg") center / cover no-repeat;
  opacity: 0;
  transition: opacity var(--dur-intro-photo) var(--ease-out);
}
.intro-photo .intro-bg::after { opacity: 1; }
.intro-logo {
  position: relative;
  display: grid;
  justify-items: center;
  gap: calc(var(--intro-logo-width) * .14);  /* 예전 그림 연출의 간격 (그림 칸 사이 .12 + 그림 안 여백) */
  color: var(--color-brand-ink);
  fill: currentColor;
}
.intro-word,
.intro-tagline { display: block; height: auto; overflow: visible; }
/* 글자 크기 = 예전 png 의 글자 크기 (png 는 가장자리에 1% 남짓 여백이 있었음 → 글자 폭 .987 / .99) */
.intro-word {
  width: calc(var(--intro-logo-width) * .987);
  aspect-ratio: 58.18 / 36.81;
  transform-origin: 0 0;                      /* 머리줄 자리 계산(--to-*)이 왼쪽 위 기준 */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--dur-intro-in) var(--ease-out), transform var(--dur-intro-in) var(--ease-out);
}
.intro-tagline {
  width: calc(var(--intro-tagline-width) * .99);
  max-width: calc(100vw - 2 * var(--gutter));
  aspect-ratio: 93.63 / 13.18;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--dur-intro-in) var(--ease-out) var(--intro-stagger), transform var(--dur-intro-in) var(--ease-out) var(--intro-stagger);
}
.intro.is-shown .intro-word,
.intro.is-shown .intro-tagline { opacity: 1; transform: none; }

.intro.is-leaving { pointer-events: none; }
.intro.is-leaving .intro-tagline { animation: fade-out calc(var(--dur-intro-out) * .4) var(--ease-out) forwards; }
.intro.is-leaving .intro-word { animation: intro-to-title var(--dur-intro-out) var(--ease-glide) forwards; }
/* 바탕은 로고가 날아가기 시작할 때부터 천천히 투명해짐 (예전엔 끝 무렵 짧게 걷혀 '너무 갑자기 사라진다'는 지적) */
.intro.is-leaving .intro-bg { animation: fade-out var(--dur-intro-bg-out) var(--ease-fade) forwards; }


/* =========================================================
   위 영역: 미리보기
   ========================================================= */
.stage {
  padding: 2px var(--gutter) var(--gap);      /* 위쪽은 머리줄이 여백 역할 */
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.stage-row {
  /* 전환 때 탭이 움직이는 거리: 탭 폭 + 미리보기 탭 쪽 모서리 (미리보기 몸통 뒤에 완전히 숨은 자리에서 출발) */
  --tab-travel: calc(var(--tab-width) + var(--tab-pop) + 2px + var(--tab-hide-depth));
  display: flex;
  width: 100%;
  max-width: calc(var(--preview-max) + var(--tab-width) + var(--tab-pop));
  margin: 0 auto;
}

.preview {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg) var(--radius-preview-tab-side) var(--radius-preview-tab-side) var(--radius-lg);
  transition: border-radius var(--dur-tab) var(--ease-out);   /* 맨 위·아래 탭이 붙을 때 그쪽 모서리가 각지게 */
  background: var(--color-preview);
  box-shadow: var(--shadow-preview);
  overflow: hidden;
  isolation: isolate;
}

.preview-canvas {
  position: absolute;
  inset: 0;
  container-type: inline-size; /* 문구 글자 크기를 미리보기 폭 기준(cqw)으로 맞추기 위함 */
}

/* 미리보기 왼쪽 위: 크게 보기 버튼 (보이는 크기는 작게, 누르는 범위는 44px) */
.preview-zoom {
  position: absolute;
  left: var(--zoom-btn-inset);
  top: var(--zoom-btn-inset);
  z-index: 3;
  display: grid;
  place-items: center;
  width: var(--zoom-btn-size);
  height: var(--zoom-btn-size);
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 3px rgba(31, 29, 26, .14), 0 0 0 1px rgba(31, 29, 26, .05);
  color: var(--color-text);
  transition: transform var(--dur-press) var(--ease-out);
}
.preview-zoom::after { content: ""; position: absolute; inset: calc((var(--zoom-btn-size) - 44px) / 2); }
.preview-zoom:active { transform: scale(var(--press-scale)); }
.preview-zoom svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ───── 미리보기 캐러셀: 1장 꾸미기 미리보기 / 2장 규격 ─────
   옆으로 넘기는 건 브라우저 스크롤(scroll-snap)에 맡김 → 손가락을 그대로 따라가고 한 장씩 딱 멈춤.
   가로만 스크롤 (세로로는 1px도 넘치지 않게 overflow: auto hidden) */
.preview-track {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: auto hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.preview-track::-webkit-scrollbar { display: none; }
.preview-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
/* 몇 번째 장인지: 미리보기 아래 가운데 작은 점 두 개 (지금 장만 길쭉하게) */
.preview-dots {
  position: absolute;
  left: 50%;
  bottom: 2px;
  z-index: 3;
  display: flex;
  translate: -50% 0;
}
.preview-dot { display: grid; place-items: center; width: 20px; height: 18px; }
.preview-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--color-text);
  opacity: .2;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-out);
}
.preview-dot.is-active::before { opacity: .75; scale: 2.2 1; }
/* 규격 장에서는 크게 보기 버튼을 숨김 (꾸미기 미리보기용) */
.preview-zoom { transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-select) var(--ease-out); }
.app.is-spec .preview-zoom { opacity: 0; pointer-events: none; }
/* 규격 장을 보는 동안 꾸미기는 멈춤: 옅게 + 눌러도 반응 없음 (JS 가 inert 도 붙여 키보드로도 못 고름) */
.tabs, .option-panel, .groups-wrap, .preview-note { transition: opacity var(--dur-select) var(--ease-out); }
.app.is-spec :is(.tabs, .option-panel, .groups-wrap, .preview-note) { opacity: var(--spec-dim); pointer-events: none; }

/* 규격 장 (가안): 지금 디자인·사이즈의 실루엣 + 가로·세로 치수 선 + 사진 자리 점선 + 아래 설명
   products.json 의 sizes[].specImage 가 있으면 그 그림 한 장이 대신 들어감 */
.spec {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 12px 22px;
  text-align: center;
}
.spec-title { margin: 0; font-size: var(--font-size-sm); font-weight: 600; color: var(--color-text-soft); }
.spec-title b { margin-right: 4px; color: var(--color-text); font-weight: 800; }
.spec-stage { flex: 1 1 auto; min-height: 0; align-self: stretch; display: grid; place-items: center; margin: 10px 0 2px; container-type: size; }
/* 그림 칸은 반드시 정사각형 (실루엣이 100% 100% 로 늘어나므로 정사각형이 아니면 모양이 찌그러지고 치수 선도 따라 틀어짐).
   예전엔 flex 안에서 aspect-ratio 로 정했는데, 아이폰 사파리는 flex로 늘어난 높이를 폭에 옮기지 않는 경우가 있어
   남는 칸의 짧은 변(cqw/cqh)으로 정함. 컨테이너 쿼리를 모르는 브라우저는 aspect-ratio 로 */
.spec-figure { position: relative; height: 100%; aspect-ratio: 1 / 1; max-width: 100%; }
@supports (width: 1cqmin) { .spec-figure { width: 100cqmin; height: 100cqmin; aspect-ratio: auto; } }
/* 실루엣: 바탕 그림(base.png) 모양에 옅은 색을 칠함 */
.spec-shape {
  position: absolute;
  inset: 0;
  background: var(--spec-shape);
  -webkit-mask: var(--mask) center / 100% 100% no-repeat;
  mask: var(--mask) center / 100% 100% no-repeat;
}
/* 사진이 들어가는 자리 (insert.box) */
.spec-photo {
  position: absolute;
  border: 1.5px dashed var(--spec-line);
  border-radius: 3px;
  background: rgba(255, 255, 255, .7);
}
/* 치수 선: 양 끝에 짧은 가로대, 가운데 글자 (위치·길이는 JS 가 제품 영역(--bx/--by/--bw/--bh, 0~1)으로) */
.spec-dim { position: absolute; color: var(--color-text); font-size: var(--font-size-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
/* 양 끝 가로대(::before)와 가운데 선(::after). 선은 칸 한가운데(가로대 가운데)에 오게 translate 로 맞춤 */
.spec-dim::before { content: ""; position: absolute; border: solid var(--spec-line); }
.spec-dim::after { content: ""; position: absolute; border: 0 solid var(--spec-line); }
.spec-dim span { position: absolute; padding: 0 4px; background: var(--color-preview); white-space: nowrap; line-height: 1.2; }
/* 가로 치수: 제품 윗변에서 --spec-dim-gap 만큼 위, 제품 왼쪽 끝 ~ 오른쪽 끝 */
.spec-dim-w {
  left: calc(var(--bx) * 100%); width: calc(var(--bw) * 100%);
  top: calc(var(--by) * 100% - var(--spec-dim-gap) - var(--spec-dim-tick)); height: var(--spec-dim-tick);
}
.spec-dim-w::before { inset: 0; border-width: 0 var(--spec-dim-line); }
.spec-dim-w::after { left: 0; right: 0; top: 50%; border-top-width: var(--spec-dim-line); translate: 0 -50%; }
.spec-dim-w span { left: 50%; top: 50%; translate: -50% -50%; z-index: 1; }
/* 세로 치수: 제품 오른쪽 끝에서 --spec-dim-gap 만큼 오른쪽, 제품 윗변 ~ 아랫변 */
.spec-dim-h {
  top: calc(var(--by) * 100%); height: calc(var(--bh) * 100%);
  left: calc((var(--bx) + var(--bw)) * 100% + var(--spec-dim-gap)); width: var(--spec-dim-tick);
}
.spec-dim-h::before { inset: 0; border-width: var(--spec-dim-line) 0; }
.spec-dim-h::after { top: 0; bottom: 0; left: 50%; border-left-width: var(--spec-dim-line); translate: -50% 0; }
.spec-dim-h span { left: calc(100% + 4px); top: 50%; translate: 0 -50%; padding: 0; background: none; }
.spec-figure:not(.is-measured) .spec-dim { visibility: hidden; }
.spec-foot { margin: 0; color: var(--color-text-faint); font-size: var(--font-size-xs); line-height: 1.35; }
.spec-foot strong { color: var(--color-text-soft); font-weight: 600; }
.spec-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* 제품군 하나의 레이어 묶음. 제품군을 바꾸면 이전 묶음이 먼저 사라지고(is-leaving), 그다음 새 묶음이 나타남 */
.stack {
  position: absolute;
  inset: 0;
  z-index: 0;                 /* 레이어들의 z-index(최대 100000)를 이 안에 가둠 → 크게 보기 버튼이 늘 위 (큰 제품이 버튼을 덮던 것) */
  /* 디자인·사이즈별 그림 배율(products.json designs[].artScale, JS 가 --art-scale 로 넣음).
     그림 아래가 캐러셀 점에 닿을 듯한 것만 조금 줄여 Forget Me Not M 만큼(393px에서 약 13px) 띄움 */
  scale: var(--art-scale, 1);
  animation: stack-in var(--dur-group) var(--ease-out) backwards;
}
.stack.is-after-leave { animation-delay: var(--dur-group-out); }
.stack.is-leaving { animation: stack-out var(--dur-group-out) var(--ease-in) forwards; }
.stack.is-instant { animation: none; }        /* 둘러보기에서 넘어올 때: 날아온 그림이 효과를 대신함 */
/* 둘러보기에서 날아오는 그림이 앉을 때까지 진짜 미리보기는 가려 둠 (같은 그림이 두 개 보이지 않게) */
.preview.is-arriving { visibility: hidden; }

/* 안쪽 공간 (거울 / 사진): 안쪽 모양 이미지(--mask)로 오린 상자. 바탕 위, 테두리 색 레이어들 아래 */
.insert {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask: var(--mask) center / 100% 100% no-repeat;
  mask: var(--mask) center / 100% 100% no-repeat;
}
/* 거울: 차가운 은빛 바탕 + 비스듬한 빛 반사 두 줄기 */
.insert-mirror {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(125deg, transparent 30%, rgba(255, 255, 255, .8) 41%, transparent 49%, transparent 57%, rgba(255, 255, 255, .45) 62%, transparent 68%),
    linear-gradient(160deg, var(--mirror-1) 0%, var(--mirror-2) 45%, var(--mirror-3) 72%, var(--mirror-4) 100%);
}
/* 액자: 손님이 직접 인생네컷 사진을 꽂는 자리. 예시로 세로 4칸 사진 한 장을 그려 '여기에 사진이 들어가요'를 보여줌
   - .insert-photo = 안쪽 공간(디자인의 box 자리, JS 가 위치·크기를 넣음). 바탕은 사진 뒤 받침 종이 색
   - .film = 인생네컷 사진(가로:세로 1:3). 자리 가운데에 들어가는 만큼 크게 (넘치는 부분은 안쪽 모양대로 잘림)
   - i = 사진 네 칸(두 사람 실루엣), b = 아래 로고 자리 */
.insert-photo {
  position: absolute;
  display: grid;
  place-items: center;
  container-type: size;
  background: var(--photo-mat);
}
.film {
  display: grid;
  grid-template-rows: repeat(4, 1fr) 9%;
  gap: 3.2%;
  height: min(94cqh, 94cqw * var(--film-ratio));
  aspect-ratio: 1 / var(--film-ratio);
  padding: 6% 7% 0;
  background: var(--film-paper);
  box-shadow: 0 0.6cqh 1.6cqh rgba(31, 29, 26, .16);
}
.film i {
  background:
    radial-gradient(circle at 37% 47%, var(--film-person) 0 12%, transparent 12.6%),
    radial-gradient(circle at 64% 44%, var(--film-person) 0 12.5%, transparent 13.1%),
    radial-gradient(34% 40% at 37% 100%, var(--film-person) 0 98%, transparent 100%),
    radial-gradient(35% 42% at 64% 100%, var(--film-person) 0 98%, transparent 100%),
    var(--film-bg, var(--film-bg-1));
}
.film i:nth-child(2) { --film-bg: var(--film-bg-2); }
.film i:nth-child(3) { --film-bg: var(--film-bg-3); }
.film i:nth-child(4) { --film-bg: var(--film-bg-4); }
.film b {                                     /* 아래 로고 자리: 작은 글씨 줄 */
  align-self: center;
  justify-self: center;
  width: 46%;
  height: 22%;
  border-radius: 99px;
  background: var(--film-logo);
}
/* 액자 예시 사진: 사이즈마다 넣는 실제 사진 (products.json 의 sizes[].photo). 자리(box)와 같은 비율이라 꽉 채움 */
.insert-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.insert > .is-entering { animation: fade-in var(--dur-layer) var(--ease-out) backwards; }

/* 미리보기 바로 아래 오른쪽 끝: [거울 | 사진] (사이즈 버튼과 같은 모양, 고른 쪽으로 흰 표시가 미끄러짐)
   폭이 모자라면 JS(fitInsertToggle)가 is-compact 를 붙여 아이콘만 남김 */
.insert-toggle {
  --i: 0;
  position: relative;
  flex: 0 0 auto;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin-left: auto;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--color-tab);
}
/* 좁으면 아이콘을 빼고 글자만 (글자가 아이콘보다 뜻이 분명해서 글자를 남김) */
.insert-toggle.is-compact .insert-btn svg { display: none; }
.insert-toggle.is-compact .insert-btn { padding: 0 12px; }
.insert-toggle[data-value="photo"] { --i: 1; }
.insert-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 2);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform var(--dur-select) var(--ease-out);
}
.insert-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 34px;
  padding: 0 11px 0 9px;
  border-radius: var(--radius-pill);
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--dur-select) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
.insert-btn::after { content: ""; position: absolute; inset: -5px 0; }   /* 누르는 범위를 44px 로 (사이즈 줄 안쪽 여백에 담김) */
.insert-btn:active { transform: scale(var(--press-scale)); }
.insert-btn.is-selected { color: var(--color-text); }
.insert-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.layer-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: fade-in var(--dur-layer) var(--ease-out) backwards;
}
.layer-img.is-instant { animation: none; }
/* 부위 모양(--mask)에 고른 색(--fill)을 입힌 판 (색마다 이미지를 만들지 않아도 됨) */
.layer-tint,
.thumb-tint {
  position: absolute;
  inset: 0;
  background: var(--fill);
  -webkit-mask: var(--mask) center / 100% 100% no-repeat;
  mask: var(--mask) center / 100% 100% no-repeat;
}
/* 질감: 부위 색판 안에 같은 색조의 더 어둡고/밝은 색을 질감 모양(tex-dark/light.png)대로 (부위 모양은 바깥 판이 오려 줌) */
.tint-tex {
  position: absolute;
  inset: 0;
  background: var(--tex-fill);
  -webkit-mask: var(--tex-mask) center / 100% 100% no-repeat;
  mask: var(--tex-mask) center / 100% 100% no-repeat;
}
.layer-img.is-leaving { animation: fade-out var(--dur-layer) var(--ease-out) both; }

/* text 옵션 글자 */
.layer-text span {
  position: absolute;
  left: calc(var(--x, 50) * 1%);
  top: calc(var(--y, 50) * 1%);
  transform: translate(-50%, -50%);
  font-size: calc(var(--size, 6) * 1cqw);
  font-weight: var(--weight, 700);
  color: var(--color, var(--color-text));
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: pre;
}

/* 바탕 이미지가 없을 때 대체 표시 */
.stack.is-base-missing::before {
  content: attr(data-missing-text);
  position: absolute;
  inset: 14%;
  display: grid;
  place-items: center;
  border: 2px dashed var(--color-line);
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  font-size: var(--font-size-sm);
}

/* 불러오는 중 표시 (아주 빨리 끝나면 보이지 않도록 살짝 늦게 등장) */
.preview-skeleton {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: var(--color-skeleton);
  animation: skeleton-in 200ms 250ms both, pulse 1.4s 450ms ease-in-out infinite;
  transition: opacity var(--dur-group) var(--ease-out);
}
.preview.has-stack .preview-skeleton { opacity: 0; animation: none; }


/* =========================================================
   디자인 둘러보기 (첫 화면): 한 화면에 디자인 하나, 아래로 넘기면 다음 디자인으로 딱 넘어감
   - 화면 전체를 덮는 세로 스크롤 상자 + scroll-snap (한 번 쓸면 한 장씩: scroll-snap-stop)
   - 머리줄(Haply·내 주문·장바구니)은 위에 고정, 오른쪽 점은 지금 몇 번째인지
   ========================================================= */
.gallery {
  position: fixed;
  inset: 0;
  z-index: 4;                                 /* 꾸미기 화면 위, 머리줄 아래 */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: var(--color-page);
}
.gallery::-webkit-scrollbar { display: none; }
.gallery-track { height: 100%; }
.slide {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;                   /* 세게 쓸어도 한 장씩 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  /* 아래 여백이 위보다 큰 만큼 그림·글이 위로 올라감 (맨 아래 화살표·이용 안내 줄 자리, 사용자 요청) */
  padding: calc(var(--topbar-height) + env(safe-area-inset-top) + 8px) var(--gutter) calc(var(--slide-bottom-space) + env(safe-area-inset-bottom));
}
/* 디자인 그림: 꾸미기 화면의 미리보기와 같은 흰 카드 (누르면 이 카드가 그대로 미리보기 자리로 날아감) */
.slide-visual {
  flex: 0 0 auto;
  width: var(--slide-visual);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  background: var(--color-preview);
  box-shadow: var(--shadow-card-soft);
  /* overflow: hidden 을 걸지 말 것 (그림은 안쪽 .thumb 가 같은 둥글기로 자름).
     아이폰 사파리에서 둥글게 자르는 요소가 효과 중일 때 그림자가 네모 영역으로 잘려,
     꾸미기에서 돌아온 직후 카드 오른쪽 아래 모서리 바깥에 진한 직각 조각이 보였음 (사용자 화면 녹화로 확인) */
  transition: transform var(--dur-press) var(--ease-out);
}
.slide-visual:active { transform: scale(.98); }
.slide-visual.is-arriving { visibility: hidden; }   /* 꾸미기에서 돌아오는 그림이 앉을 때까지 */
.slide-visual .thumb,
.morph .thumb {
  --thumb-size: 100%;
  background: none;
  box-shadow: none;
  /* 둘러보기 카드·날아가는 복사본 안의 그림 칸은 자르지 않음 (그림은 가장자리에서 떨어져 있어 넘치지 않음).
     둥글게 자르면(overflow: hidden + border-radius) 아이폰 사파리가 그 테두리에 옅은 회색 선을 그려,
     둘러보기 카드 네 모서리에 카드 가장자리와 다른 실선이 보였음 (사용자 지적, 2026-11-13) */
  overflow: visible;
  border-radius: 0;
}
/* 둘러보기 카드·날아가는 복사본도 미리보기와 같은 사이즈별 배율 (날아와 앉을 때 크기가 툭 바뀌지 않게). 장바구니 썸네일은 그대로 */
.slide-visual .thumb > *,
.morph .thumb > * { scale: var(--art-scale, 1); }
/* 이미지가 다 준비될 때까지 그림을 숨겼다가 한 번에 나타냄 (거울만 먼저 보이지 않게) */
.slide-visual .thumb { transition: opacity var(--dur-layer) var(--ease-out); }
.slide-visual.is-loading .thumb { opacity: 0; transition: none; }
.slide-info { display: flex; flex-direction: column; align-items: center; text-align: center; }
.slide-count { margin: 0 0 6px; color: var(--color-text-faint); font-size: var(--font-size-xs); font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.slide-name { margin: 0; font-size: var(--font-size-slide); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.slide-desc { margin: 6px 0 0; color: var(--color-text-soft); font-size: var(--font-size-md); }
.slide-price { margin: 6px 0 0; color: var(--color-text-soft); font-size: var(--font-size-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.slide-cta { margin-top: 18px; min-width: 180px; }
.btn.slide-cta { background: var(--color-cta); color: var(--color-cta-text); }   /* .btn-primary 보다 뒤에서 이기도록 .btn 을 붙임 */
/* 첫 장 아래: 살짝 오르내리는 화살표만 ('아래로 넘겨 다른 디자인 보기' 글은 사용자 요청으로 뺌) */
.slide-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(68px + env(safe-area-inset-bottom));   /* 버튼과 맨 아래 고정 줄(이용 안내) 사이 가운데쯤 (시안 C, 사용자가 고름): 링크에 붙어 있으면 '누르라'는 표시로 보여서 위로 띄움 */
  margin: 0;
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
  text-align: center;
}
.slide-hint::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 6px auto 0;
  border: solid currentColor;
  border-width: 0 1.6px 1.6px 0;
  rotate: 45deg;
  animation: hint-bob 1.6s var(--ease-out) infinite;
}
/* 오른쪽 점: 지금 디자인만 길쭉하게 */
.gallery-dots {
  position: fixed;
  right: max(6px, env(safe-area-inset-right));
  top: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  translate: 0 -50%;
}
.gallery-dot { position: relative; display: grid; place-items: center; width: 24px; height: 20px; }
.gallery-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--color-text);
  opacity: .22;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-out);
}
.gallery-dot.is-active::before { opacity: .85; scale: 1 2.4; }
/* 맨 아래 판매자 정보 자리: 색이 다른 마름모 (고르면 점처럼 세로로 길쭉해짐. rotate 대신 clip-path라 늘려도 마름모 그대로) */
.gallery-dot.is-biz::before {
  width: 8px;                                 /* 보이는 마름모는 6px. 상자를 1px씩 넉넉히 두어 꼭짓점이 상자 끝에서 잘리지 않게 */
  height: 8px;
  border-radius: 0;
  background: var(--color-dot-biz);
  clip-path: polygon(50% 12.5%, 87.5% 50%, 50% 87.5%, 12.5% 50%);
  opacity: 1;
  transition: background-color var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-out);
}
.gallery-dot.is-biz.is-active::before { background: var(--color-dot-biz-active); scale: 1 2; }

/* 화면 상태: 둘러보기일 때 꾸미기 화면은 숨기고(자리는 남겨 두어 전환 때 바로 잴 수 있게) 머리줄은 위에 고정 */
.app[data-view="gallery"]:not(.is-leaving-custom) .stage,
.app[data-view="gallery"]:not(.is-leaving-custom) .panel { visibility: hidden; }
.app[data-view="custom"] .gallery:not(.is-leaving) { display: none; }
html.is-gallery, html.is-gallery body { overflow: hidden; }
/* (꾸미기 → 둘러보기 전환 중에는 머리줄을 제자리에 둠: 먼저 고정으로 바뀌면 그만큼 꾸미기 화면이 위로 튀었음) */
html.is-gallery .app:not(.is-leaving-custom) .topbar {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  z-index: 6;
  max-width: var(--wide-max-width);
  margin: 0 auto;
  background: var(--color-page);
}
html.is-gallery .checkout { z-index: 7; }     /* 숨은 주문 바 안의 안내 카드가 둘러보기 위에 뜨도록 */
html.is-gallery .added-card {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: calc(var(--max-width) - 2 * var(--gutter));
  margin: 0 auto;
  visibility: visible;
}

/* 전환 효과 (화면 전체가 함께 움직임. 예전엔 그림만 조금 움직이고 나머지는 옅어지기만 해서 '움찔'하고 옹졸해 보인다는 지적)
   - 둘러보기 → 꾸미기(is-leaving / is-entering):
     둘러보기의 이름·설명·버튼은 아래로 빠지며 사라지고, 그림 카드(.morph 복사본)는 미리보기 자리로 날아감.
     동시에 아래 흰 선택 창이 화면 밑에서 끝까지 올라오고, 사이즈 줄이 떠오름.
     그림이 미리보기 자리에 거의 앉으면(--view-tab-delay) 탭들이 미리보기 안에 숨어 있다가 오른쪽으로 하나씩 쇽 나옴
     (탭 열(.tabs)이 overflow: clip 이라, 왼쪽으로 100% 밀어 둔 탭은 미리보기 가장자리 뒤에 숨은 것처럼 보임.
      예전엔 화면 오른쪽 밖에서 들어왔고, 끝난 뒤 탭의 원래 등장 효과(tab-in)가 한 번 더 돌아 깜빡였음 → .tabs.is-quiet 로 막음)
   - 꾸미기 → 둘러보기(is-leaving-custom / is-entering): 반대로. 탭이 먼저 미리보기 안으로 쏙 들어가고(--dur-view-tab-out),
     그다음 그림이 둘러보기 자리로 날아감. 선택 창은 처음부터 아래로 빠짐
   - 날아간 복사본은 도착한 뒤 진짜 그림과 겹친 채 옅어지며 사라짐(--dur-morph-fade).
     둘러보기 카드와 미리보기는 모서리 모양이 달라서(탭 쪽 모서리), 바로 지우면 모서리가 툭 바뀌었음
   - 전환 중에는 둘러보기 바탕을 투명하게 해서 아래 꾸미기 화면이 움직이는 게 보이게 함 (두 화면 바탕색이 같아 끝나고 되돌려도 티 안 남)
   - 진짜 미리보기는 그림이 날아가는 동안 숨김 (같은 그림이 두 개 보이지 않게) */
/* 전환 중에는 둘러보기를 꾸미기 화면 아래로 내림 → 올라오는 흰 선택 창이 둘러보기 글자를 덮으며 올라오고,
   돌아갈 때는 내려가는 창 뒤에서 글자가 드러남 (둘러보기가 위에 있으면 글자가 흰 창 위에 겹쳐 지저분했음) */
.gallery.is-leaving,
.gallery.is-entering { background: transparent; z-index: 1; }
.app.is-entering .panel,
.app.is-leaving-custom .panel { position: relative; z-index: 5; }
.gallery.is-leaving { pointer-events: none; }
.gallery.is-leaving :is(.slide-info, .gallery-dots) { animation: view-drop-out var(--dur-view-out) var(--ease-in) forwards; }
.gallery.is-entering :is(.slide-info, .gallery-dots) { animation: view-drop-in var(--dur-view) var(--ease-view) var(--view-late) backwards; }
/* 아래 안내 글은 제자리에서 옅어지기만 (움직이면 위쪽 장의 안내 글까지 화면 안으로 밀려 들어옴) */
.gallery.is-leaving .slide-hint { animation: fade-out var(--dur-view-out) var(--ease-in) forwards; }
.gallery.is-entering .slide-hint { animation: fade-in var(--dur-view) var(--ease-out) var(--view-late) backwards; }
.app.is-entering .panel,
.app.is-entering::before { animation: view-sheet-in var(--dur-view) var(--ease-view) var(--view-stagger) backwards; }   /* ::before = 좌우 배치의 흰 판 */
/* 전환이 끝난 탭은 효과 없음 (전환 효과를 걷을 때 원래 등장 효과 tab-in 이 다시 돌며 깜빡이지 않게. 탭을 새로 그리면 JS 가 걷음) */
.tabs.is-quiet .tab { animation: none; }
/* 탭은 움직이기 시작할 때까지 숨겨 둠(view-tab-wait): 출발 자리는 미리보기 뒤지만, 그림이 날아오는 동안에는 그 자리를 덮는 것이 없어서 */
.app.is-entering .tab {
  animation:
    view-tab-in var(--dur-view-tab) var(--ease-view-tab) calc(var(--view-tab-delay) + var(--view-stagger) * var(--i, 0)) backwards,
    view-tab-wait calc(var(--view-tab-delay) + var(--view-stagger) * var(--i, 0)) step-end;
}
.app.is-entering .groups-wrap { animation: view-rise-in var(--dur-view) var(--ease-view) calc(var(--view-stagger) * 3) backwards; }
.app.is-leaving-custom .panel,
.app.is-leaving-custom::before { animation: view-sheet-out var(--dur-view-out) var(--ease-in) forwards; }
.app.is-leaving-custom .tab { animation: view-tab-out var(--dur-view-tab-out) var(--ease-view-tab) forwards; }
/* 전환 중 탭은 진짜로 '미리보기 뒤'에 숨어 있다가 나옴 (사용자 요청: 미리보기 안에 숨어 있던 버튼이 밀려 나오듯)
   - 미리보기(와 날아오는 복사본)를 탭 위에 올리고, 탭 열은 미리보기 가장자리에서 자르지 않음
     → 맨 위 탭은 오른쪽 가장자리를 넘기 전에 미리보기의 둥근 모서리 틈으로 탭 끝이 먼저 보이며 밀려 나옴
   - 미리보기(와 날아오는 그림)의 모서리 모양은 전환 내내 그대로 (둘러보기 카드와 같은 --radius-lg). 모서리가 바뀌는 건 탭이 나와 덮을 때뿐
   - 탭은 미리보기 몸통 뒤 깊은 곳(--tab-travel = 탭 폭 + --tab-hide-depth)에서 출발해, 가장자리를 넘을 때는 이미 빠르게 움직임.
     움직이기 전에는 숨기고(view-tab-wait), 모서리보다 왼쪽은 잘라서(clip-path) 그림이 날아오는 동안 미리보기 자리에 탭이 미리 비치지 않게
   - 전환 중 미리보기 탭 쪽 모서리는 둥근 채, 선택된 탭의 바탕은 모서리만큼 왼쪽(미리보기 뒤)으로 늘림
     → 다 나오면 탭 바탕이 모서리 빈 곳을 채워 평소의 각진 이음과 똑같은 모양. 끝날 때 원래 모양으로 바꿔도 티 안 남(JS: settlePreviewCorner)
   - 선택 안 된 탭이 미리보기 가장자리 위를 지나며 가는 줄이 비치던 것(탭 열이 미리보기를 2px 덮고 있어서)도 미리보기 뒤로 지나가므로 없음
   (거쳐 온 것: 미리보기 가장자리에서 잘라 내보냄 → 둥근 모서리 옆이 비었다 툭 채워짐 / 모서리만 따로 채움 → '모서리를 따로 채울 필요 없이
    버튼이 미리보기 안에서 밀려 나오는 것처럼 모서리 빈 곳부터 보여야 한다'는 지적) */
/* 전환 중 미리보기 탭 쪽 모서리는 각지게 바꾸지 않고 둥근 채 (.stage-row[data-edge] .preview 보다 우선)
   → 탭이 이 둥근 모서리 뒤에서 나오며 모서리 틈을 지나감. 다 나오면 선택된 탭 바탕(왼쪽으로 늘림)이 틈을 덮어 평소의 각진 이음과 같은 모양 */
.app:is(.is-entering, .is-leaving-custom) .stage-row .preview {
  z-index: 2;
  /* 전환 중에는 둥글게 자르지 않음 (그림은 모서리까지 닿지 않음). 효과 중인 그림을 둥글게 자르면 아이폰 사파리가
     테두리에 옅은 회색 선을 그려, 흰 맨 위 탭이 뒤에서 나올 때 미리보기 모서리 경계선이 잠깐 보였음 (사용자 화면 녹화로 확인) */
  overflow: visible;
  border-top-right-radius: var(--radius-preview-tab-side);
  border-bottom-right-radius: var(--radius-preview-tab-side);
  transition: none;
}
.app:is(.is-entering, .is-leaving-custom) .tabs {
  overflow: visible;
  clip-path: inset(0 0 0 calc(2px - var(--radius-preview-tab-side)));   /* 왼쪽 끝 = 미리보기 모서리가 시작하는 곳 */
}
.app:is(.is-entering, .is-leaving-custom) .tab.is-active .tab-bg { left: calc(-1 * var(--radius-preview-tab-side)); }
/* 돌아갈 때: 탭이 미리보기 뒤로 다 숨으면(--view-fly-delay) 바로 그림이 날아가고(미리보기 is-arriving), 그때 탭 열을 숨김
   (탭이 숨은 채 마저 움직이는 동안 기다리면 다 들어간 뒤에도 잠깐 멈춘 듯한 틈이 생겼음) */
.app.is-leaving-custom .preview.is-arriving ~ .tabs { visibility: hidden; }
.app.is-leaving-custom .groups-wrap { animation: view-drop-out var(--dur-view-out) var(--ease-in) forwards; }
.morph {
  position: fixed;
  z-index: 9;
  container-type: inline-size;
  transform-origin: 0 0;
  pointer-events: none;
  animation: morph-to var(--dur-view) var(--ease-view) forwards;
  /* 바탕과 그림의 둥글기를 하나로 (그림은 안쪽 .thumb 가 border-radius: inherit 로 같은 모양으로 자름). 반드시 한 장으로 둘 것:
     예전에 바탕 판과 그림 판을 따로 두고 둥글기를 다르게 했더니(바탕 10px / 그림 22px),
     아이폰 사파리가 그림 판의 둥근 테두리에 옅은 회색 선을 그려서 그 바깥 바탕 모서리가
     '미리보기 오른쪽 위에 덧대진 조각'처럼 보였음 (사용자 화면 녹화로 확인. PC 크롬에서는 안 보임)
     복사본 자신에는 overflow: hidden 을 걸지 않음: 움직이는 요소를 둥글게 자르면 사파리가 테두리에 회색 선을 그려,
     흰 탭이 뒤로 지나갈 때 모서리 경계선이 드러났음 */
  border-radius: var(--r, var(--radius-lg));
  background: var(--color-preview);
}
/* 도착한 뒤: 자리는 그대로 붙잡은 채(morph-to 는 이미 끝난 같은 효과라 다시 돌지 않음) 옅어지며 진짜 그림에 녹아듦 */
.morph.is-landed { animation: morph-to var(--dur-view) var(--ease-view) forwards, fade-out var(--dur-morph-fade) var(--ease-out) forwards; }
.morph * { animation: none !important; }


/* =========================================================
   위 영역: 오른쪽 책갈피 탭
   구조: [미리보기 칸][틈 --tab-pop][탭 --tab-width]  (탭 버튼 자체는 틈까지 포함한 전체 폭)
   - 선택 안 된 탭: 미리보기 칸에서 --tab-pop 떨어진, 오른쪽이 둥근 책갈피
   - 선택된 탭: 오른쪽 끝은 다른 탭과 같은 자리에 둔 채 왼쪽으로만 늘어나 미리보기 칸에 붙음
     → 다른 탭보다 넓어져서 '선택됨'이 분명하고, 같은 색 + 오목한 이음매로 미리보기와 한 몸처럼 보임
   - 배치 방식은 JS가 탭 개수와 미리보기 높이를 보고 고름 (data-mode)
     top    : 탭이 적을 때. 최대 높이로 미리보기 맨 위에 딱 붙여 시작
     fill   : 탭이 많을 때. 미리보기 높이를 위아래 끝까지 꽉 채움
     scroll : 최소 높이로도 넘칠 때만. 둥근 모서리를 피한 레일 안에서 세로 스크롤
   - 이음매 규칙: 이음매는 항상 미리보기의 '곧은 가장자리'와 만남
     맨 위(아래)에 딱 붙은 탭은 이음매 대신 미리보기 그쪽 모서리를 각지게 바꿔 이어 붙임 (data-edge)
     JS가 top 모드를 고를 때 아래쪽에 (모서리 + 이음매) 높이 이상의 여유가 남는지 확인함
   ========================================================= */
.tabs {
  position: relative;
  z-index: 1;
  flex: 0 0 calc(var(--tab-width) + var(--tab-pop) + 2px);
  margin-left: -2px;                          /* 선택된 탭이 미리보기 가장자리를 2px 덮어 이음새 없앰 */
  display: flex;
  flex-direction: column;
  gap: var(--tab-gap);
  contain: size;                              /* 탭 수와 상관없이 높이는 미리보기 칸에 맞춤 */
  overflow: hidden;                           /* 가로로 밀리거나 잘리지 않음 */
  overflow: clip;                             /* + 코드나 포커스 이동으로도 스크롤되지 않음 (지원 안 하는 브라우저는 위 hidden) */
  touch-action: pan-y;                        /* 탭 위에서 가로로 쓸어도 아무것도 움직이지 않음 */
}
.tabs[data-mode="fill"] .tab { flex: 1 1 0; }
.tabs[data-mode="scroll"] {
  margin-block: var(--radius-preview-tab-side);
  padding-block: var(--tab-fillet);
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--tab-fillet), #000 calc(100% - var(--tab-fillet)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--tab-fillet), #000 calc(100% - var(--tab-fillet)), transparent);
}
.tabs[data-mode="scroll"] .tab { flex: 0 0 var(--tab-min-height); }
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  flex: 0 0 var(--tab-max-height);
  min-height: var(--tab-min-height);
  width: 100%;
  padding: 4px 4px 4px calc(var(--tab-pop) + 6px);   /* 글자는 선택 안 된 탭의 보이는 부분 가운데에 */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  transition: color var(--dur-tab) var(--ease-out);
  animation: tab-in var(--dur-tab) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 30ms);
  container-type: size;                       /* 탭 높이에 따라 안쪽 글자 배치를 바꾸기 위함 (아래 @container) */
}
.tab:active { color: var(--color-text); }

/* 탭 사이 틈까지 누를 수 있게 하는 보이지 않는 누름 영역 */
.tab-hit {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--tab-gap) / -2);
  bottom: calc(var(--tab-gap) / -2);
}

/* 탭이 낮아지면 (탭이 많거나 글씨를 크게 설정한 폰) 이름은 한 줄로, 점은 숨김 */
@container (max-height: 40px) {
  .tab-label { -webkit-line-clamp: 1; }
  .tab-dot { display: none; }
}
/* 그래도 이름이 탭을 넘치면 (글씨를 크게 설정한 폰 등) JS가 단계적으로 붙임:
   점 숨김 → 글자 조금 줄임 → 더 줄임(두 줄까지) → 한 줄 말줄임(최후) */
.tab.fit-1 .tab-dot { display: none; }
.tab.fit-2 .tab-label { font-size: .86em; }
.tab.fit-3 .tab-label { font-size: .74em; }
.tab.fit-4 .tab-label { -webkit-line-clamp: 1; }
.tab.is-active { color: var(--color-text); font-weight: 600; }

/* 탭의 배경: 선택 안 됨 = 틈 오른쪽만 보임 / 선택됨 = 왼쪽 끝(미리보기)까지 펼쳐짐 */
.tab-bg {
  position: absolute;
  inset: 0;
  background: var(--color-tab);
  clip-path: inset(0 0 0 calc(var(--tab-pop) + 2px) round 0 var(--radius-sm) var(--radius-sm) 0);
  transition:
    clip-path var(--dur-tab) var(--ease-out),
    background-color var(--dur-tab) var(--ease-out);
}
.tab.is-active .tab-bg {
  background: var(--color-preview);
  clip-path: inset(0 0 0 0 round 0 var(--radius-sm) var(--radius-sm) 0);
}

/* 이름 + 점. 선택되면 넓어진 탭의 가운데로 살짝 이동 */
.tab-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  transition: translate var(--dur-tab) var(--ease-out);
}
.tab.is-active .tab-inner { translate: calc((var(--tab-pop) + 2px) / -2) 0; }

/* 선택된 탭과 미리보기 칸이 만나는 위·아래의 오목한 이음매 */
.tab::before,
.tab::after {
  content: "";
  position: absolute;
  left: 0;
  width: var(--tab-fillet);
  height: var(--tab-fillet);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-tab) var(--ease-out);
}
.tab::before {
  bottom: 100%;
  background: radial-gradient(circle at 100% 0, transparent calc(var(--tab-fillet) - .5px), var(--color-preview) var(--tab-fillet));
}
.tab::after {
  top: 100%;
  background: radial-gradient(circle at 100% 100%, transparent calc(var(--tab-fillet) - .5px), var(--color-preview) var(--tab-fillet));
}
.tab.is-active::before,
.tab.is-active::after { opacity: 1; }
/* 미리보기 맨 위·맨 아래에 딱 붙은 탭은 그쪽 이음매 대신 미리보기 모서리를 각지게 해서 이음 */
.tabs:not([data-mode="scroll"]) .tab:first-child::before,
.tabs[data-mode="fill"] .tab:last-child::after { display: none; }
.stage-row[data-edge~="top"] .preview { border-top-right-radius: 0; }
.stage-row[data-edge~="bottom"] .preview { border-bottom-right-radius: 0; }

.tab-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 탭 아래 작은 점: 현재 고른 색(또는 문구 입력 여부) */
.tab-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot, transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  opacity: 0;
  scale: .4;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-spring), background-color var(--dur-select) var(--ease-out);
}
.tab.has-dot .tab-dot { opacity: 1; scale: 1; }

.tab-skeleton {
  flex: 0 0 var(--tab-max-height);
  width: var(--tab-width);
  margin-left: calc(var(--tab-pop) + 2px);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--color-skeleton);
  animation: skeleton-in 200ms 250ms both;
}


/* =========================================================
   위 영역: 제품군 버튼 (선택 표시가 미끄러져 이동)
   ========================================================= */
/* 배치: [왼쪽 여백][제품군 버튼][오른쪽 여백 = 탭 열 폭 + 왼쪽 여백]
   - 버튼이 미리보기 폭 안에 들어가면 → 미리보기 기준 가운데
   - 미리보기보다 넓으면 → 오른쪽 여백(탭 열 폭)이 줄어들며 자연스럽게 오른쪽으로 펼쳐짐
   - 화면보다 넓을 때만 → 가로 스크롤
   이렇게 해야 넘치지 않을 때는 가로·세로 어느 쪽으로도 움직이지 않음 */
.groups-wrap {
  display: flex;
  margin: calc(var(--gap) - 5px) 0 -5px;      /* 버튼 누름 영역(위아래 5px)을 안쪽에 담기 위한 여백을 겉에서 상쇄 */
  padding: 5px 0;
  overflow: auto hidden;                      /* 가로만 스크롤 (넘칠 때만), 세로로는 절대 움직이지 않음 */
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.groups-wrap::-webkit-scrollbar { display: none; }
.groups-wrap::before { content: ""; flex: 1 1 0; }
.groups-wrap::after { content: ""; flex: 1 1 calc(var(--tab-width) + var(--tab-pop)); }
/* 거울/사진 버튼이 있으면: 사이즈는 미리보기 왼쪽 끝에, 거울/사진은 오른쪽 끝에 (가운데 맞춤용 여백은 끔) */
.groups-wrap.has-insert { gap: 8px; }
.groups-wrap.has-insert .group-btn { padding: 0 10px; }   /* 두 줄을 한 줄에 담으려고 사이즈 버튼을 조금 좁힘 */
/* 아주 좁은 화면: 작은 설명을 숨기고 버튼 안 여백을 줄임 → 그래도 넘치면 글자를 한 단계 작게 (is-tighter) */
.groups-wrap.is-tight { gap: 6px; }
.groups-wrap.is-tight .size-note { display: none; }
.groups-wrap.is-tight .group-btn { padding: 0 8px; }
.groups-wrap.is-tight .insert-toggle.is-compact .insert-btn { padding: 0 8px; }
.groups-wrap.is-tighter .group-btn,
.groups-wrap.is-tighter .insert-btn { font-size: var(--font-size-xs); }
.groups-wrap.has-insert::before,
.groups-wrap.has-insert::after { display: none; }

.groups {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;             /* 버튼마다 이름 길이만큼 ('세로형' / '폴라로이드형') */
  flex: 0 0 auto;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--color-tab);
}

/* 고른 버튼 아래 흰 표시: 줄 전체에 흰 판을 깔고 clip-path 로 고른 버튼 자리만 남김
   (버튼 폭이 제각각이라 위치와 폭이 함께 바뀌어야 함. 늘려서 맞추면 둥근 끝이 찌그러짐)
   그림자는 잘리지 않게 바깥(.groups-indicator)의 drop-shadow 로 */
.groups-indicator {
  position: absolute;
  inset: 3px;
  filter: drop-shadow(0 1px 1.5px rgba(31, 29, 26, .14));
  pointer-events: none;
}
.groups-indicator::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  clip-path: inset(0 var(--ind-r, 100%) 0 var(--ind-l, 0px) round var(--radius-pill));
  transition: clip-path var(--dur-group) var(--ease-out);
}
.groups:not(.is-ready) .groups-indicator { opacity: 0; }

.group-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--dur-group) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
.group-btn:active { transform: scale(var(--press-scale)); }
.group-btn.is-selected { color: var(--color-text); }
/* 보이는 높이는 34px, 누르는 범위는 위아래로 넓혀 44px */
.group-btn::after { content: ""; position: absolute; inset: -5px 0; }

/* 사이즈 버튼 글자: 이름 굵게 + (있으면) 'cm' 같은 작은 설명 */
.size-name { font-weight: 700; }
.size-note { font-size: var(--font-size-xs); font-weight: 500; color: var(--color-text-faint); transition: color var(--dur-group) var(--ease-out); }
.group-btn.is-selected .size-note { color: var(--color-text-soft); }

/* 고른 사이즈의 설명: [S M L] 오른쪽 빈 곳에 ('세로형 네컷사진 사이즈'). 자리가 모자라면 두 줄까지 */
.size-desc {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 0 0 2px;
  padding-left: 10px;
  border-left: 1px solid var(--color-line);   /* 사이즈 버튼과 설명 사이 옅은 세로줄: 설명이 S/M/L 에 딸린 글로 읽히게 */
  align-self: center;
  color: var(--color-text-soft);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;                          /* 두 줄이 되면 줄 길이를 비슷하게 (한쪽에 한 단어만 남지 않게) */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-height: 2.5em;
  overflow: hidden;
}
/* 아주 좁은 폰(320px 등): 세 줄까지 (두 줄이면 '와이드형 / 네컷사진…'처럼 잘림) */
.groups-wrap.is-tight .size-desc { -webkit-line-clamp: 3; max-height: 3.6em; line-height: 1.2; padding-left: 8px; }
.size-desc:empty { display: none; }
.size-desc.is-changed-a { animation: label-a var(--dur-select) var(--ease-out); }
.size-desc.is-changed-b { animation: label-b var(--dur-select) var(--ease-out); }


/* =========================================================
   아래 영역
   ========================================================= */
.panel {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

/* '이미지는 실제 제품과 다를 수 있어요': 옵션 이름 줄 오른쪽 끝에 작게 (탭을 바꿔도 다시 그리지 않게 선택 영역에 고정)
   자리가 모자라면 JS fitPreviewNote 가 짧은 글로(is-short), 그래도 겹치면 숨김(is-hidden) */
.panel { position: relative; }
.preview-note {
  position: absolute;
  top: 14px;
  right: var(--gutter);
  z-index: 1;
  margin: 0;
  line-height: 24px;
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  pointer-events: none;
}
.preview-note::before { content: "* "; }
.preview-note .note-short,
.preview-note.is-short .note-long { display: none; }
.preview-note.is-short .note-short { display: inline; }
.preview-note.is-hidden { visibility: hidden; }

.option-panel {
  position: relative;
  min-height: var(--option-body-height);
  overflow: hidden;
}

/* 탭을 바꿀 때마다 새로 그려지며 등장 (아래 탭으로 가면 아래에서, 위 탭으로 가면 위에서) */
.option-body {
  min-height: var(--option-body-height);
  padding-top: 14px;
  animation: panel-in-down var(--dur-panel) var(--ease-out) backwards;
}
.option-body[data-dir="up"] { animation-name: panel-in-up; }
.option-body[data-dir="none"] { animation-name: fade-in; }

.option-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  padding: 0 var(--gutter);
  margin-bottom: 6px;
}
.option-name { margin: 0; font-size: var(--font-size-md); font-weight: 700; }
.option-desc { margin: 0; color: var(--color-text-soft); font-size: var(--font-size-sm); }

/* 옵션 이름 옆 '지금 고른 색': ● 이름 +가격 (고르면 점이 살짝 튐) */
.option-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
}
.option-pick-dot {
  flex: 0 0 auto;
  width: var(--pick-dot-size);
  height: var(--pick-dot-size);
  border-radius: 50%;
  background-size: cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.option-pick-dot[data-bump="a"] { animation: pick-bump-a var(--dur-select) var(--ease-spring); }
.option-pick-dot[data-bump="b"] { animation: pick-bump-b var(--dur-select) var(--ease-spring); }
.option-pick-name { overflow: hidden; text-overflow: ellipsis; }
.option-pick-price { color: var(--color-text-faint); font-variant-numeric: tabular-nums; }
.option-pick-price:empty { display: none; }
.option-empty { margin: 0; padding: 24px var(--gutter); color: var(--color-text-faint); text-align: center; }

.option-skeleton {
  display: flex;
  gap: 10px;
  padding: 44px var(--gutter) 0;
}
.option-skeleton span {
  width: var(--choice-size);
  height: var(--choice-size);
  margin: 0 calc((var(--choice-width) - var(--choice-size)) / 2);
  border-radius: var(--radius-md);
  background: var(--color-skeleton);
  animation: skeleton-in 200ms 250ms both;
}


/* ── 선택지 (가로 스크롤) ── */
.choices-wrap { position: relative; }

/* 스크롤할 내용이 더 있으면 가장자리를 흐리게 */
.choices-wrap::before,
.choices-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 28px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms linear;
}
.choices-wrap::before { left: 0; background: linear-gradient(to right, var(--color-surface), transparent); }
.choices-wrap::after { right: 0; background: linear-gradient(to left, var(--color-surface), transparent); }
.choices-wrap.has-more-left::before,
.choices-wrap.has-more-right::after { opacity: 1; }

/* 컴퓨터(마우스)에서만: 양 끝 화살표 버튼 (그쪽에 더 있을 때만 나타남) */
.choices-arrow { display: none; }
@media (hover: hover) and (pointer: fine) {
  .choices-arrow {
    position: absolute;
    top: calc(10px + var(--choice-size) / 2 - 16px);   /* 색 견본 높이의 가운데 */
    z-index: 2;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-raised), 0 0 0 1px var(--color-line);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-select) var(--ease-out), transform var(--dur-press) var(--ease-out);
  }
  .choices-arrow::before {                    /* 꺾쇠 */
    content: "";
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
  }
  .choices-arrow.is-prev { left: 6px; }
  .choices-arrow.is-prev::before { rotate: 135deg; margin-left: 3px; }
  .choices-arrow.is-next { right: 6px; }
  .choices-arrow.is-next::before { rotate: -45deg; margin-right: 3px; }
  .choices-arrow:active { transform: scale(var(--press-scale)); }
  .choices-wrap.has-more-left .choices-arrow.is-prev,
  .choices-wrap.has-more-right .choices-arrow.is-next { opacity: 1; pointer-events: auto; }
}

/* 옆으로 더 있는 선택지 줄을 처음 볼 때 한 번: 줄이 왼쪽으로 살짝 밀렸다 돌아옴 */
.choices.is-hinting > .choice { animation: choices-hint var(--dur-hint) var(--ease-out) var(--hint-delay); }

.choices {
  display: flex;
  gap: 4px;
  padding: 6px var(--gutter) 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.choices::-webkit-scrollbar { display: none; }

.choice {
  flex: 0 0 auto;
  min-width: var(--choice-width);             /* 평소엔 이 폭. 글씨를 크게 설정하면 가격이 들어갈 만큼 넓어짐 */
  max-width: calc(var(--choice-width) * 1.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 2px 2px;
  border-radius: var(--radius-md);
  scroll-snap-align: start;
  transition: transform var(--dur-press) var(--ease-out);
}
.choice:active { transform: scale(var(--press-scale)); }
.choice:focus-visible { outline-offset: -2px; }

.choice-swatch {
  position: relative;
  width: var(--choice-size);
  height: var(--choice-size);
  border-radius: var(--radius-md);
  background: var(--swatch, var(--color-skeleton));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07);
}
.choice-swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* 선택 테두리 */
.choice-swatch::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid var(--color-accent);
  border-radius: calc(var(--radius-md) + 4px);
  opacity: 0;
  scale: .92;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-out);
}
.choice.is-selected .choice-swatch::after { opacity: 1; scale: 1; }

/* 선택 체크 */
.choice-check {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-surface);
  opacity: 0;
  scale: .3;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-spring);
}
.choice-check::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 5px;
  height: 9px;
  border: solid var(--color-accent-text);
  border-width: 0 2px 2px 0;
  rotate: 45deg;
}
.choice.is-selected .choice-check { opacity: 1; scale: 1; }

.choice-initial {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--color-text-soft);
  font-size: var(--font-size-md);
  font-weight: 700;
}

.choice-name {
  max-width: 100%;
  padding: 0 2px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur-select) var(--ease-out);
}
.choice.is-selected .choice-name { color: var(--color-text); font-weight: 600; }

.choice-price {
  min-height: 1.2em;
  margin-top: -4px;
  font-size: var(--font-size-xs);
  line-height: 1.2;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;                        /* "+1,000원"이 숫자 중간에서 줄바꿈되지 않게 */
}

/* 품절 */
.choice.is-soldout { cursor: not-allowed; }
.choice.is-soldout:active { transform: none; }
.choice.is-soldout .choice-swatch { opacity: .35; }
.choice.is-soldout .choice-swatch::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 2px;
  background: var(--color-text-soft);
  rotate: 45deg;
}
.choice.is-soldout .choice-name { color: var(--color-text-faint); }
.choice.is-soldout .choice-price { color: var(--color-danger); font-weight: 600; }


/* ── 색 팔레트 (색이 많은 옵션): 이름 없이 색 칸만 격자로
   한 줄 칸 수 = products.json 팔레트의 columns (--palette-cols, 기본 15 = 3계열 × 5단계) → 45색이면 3줄
   줄마다 왼쪽 → 오른쪽으로 계열 하나씩 밝은 → 진한 (무채색·레드·오렌지 / 옐로·그린·민트 / 블루·퍼플·핑크)
   세로를 3줄로 낮게 해서 미리보기를 크게 쓰고, 폭이 모자라면 옆으로 넘김 (마지막 칸이 반만 보이게, 계열 경계에서 멈춤)
   칸 크기(--palette-cell)는 JS(fitPalette)가 폭에 맞춰 정함 */
.choices.is-palette {
  display: grid;
  grid-template-columns: repeat(var(--palette-cols, 15), var(--palette-cell));
  grid-auto-rows: var(--palette-cell);
  gap: 0;
  padding: 2px calc(var(--gutter) - var(--palette-cell-pad)) 8px;   /* 칸 안쪽 여백만큼 당겨 색 칸 끝을 글자 줄에 맞춤 */
  overflow: auto hidden;                      /* 옆으로만 넘김. 위아래로는 1px 도 움직이지 않게 */
  scroll-snap-type: x proximity;
  scroll-padding: 0 calc(var(--gutter) - var(--palette-cell-pad));
}
.swatch-cell {
  min-width: 0;
  max-width: none;
  padding: var(--palette-cell-pad);
  gap: 0;
  border-radius: var(--palette-radius);
  scroll-snap-align: none;
}
.swatch-cell.is-group-start { scroll-snap-align: start; }   /* 넘기면 계열의 첫 칸에서 멈춤 */
/* 컴퓨터의 양 끝 화살표: 팔레트 높이의 가운데 */
.choices-wrap.is-palette .choices-arrow { top: calc(50% - 16px); }
.swatch-cell .choice-swatch {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--palette-radius);
}
.swatch-cell .choice-swatch::after {          /* 선택 테두리: 칸 가장자리까지 (옆 칸 색과 겹치지 않게) */
  inset: calc(-1 * var(--palette-cell-pad));
  border-radius: calc(var(--palette-radius) + var(--palette-cell-pad));
}


/* ── 글자 입력 (text 옵션) ── */
.text-field {
  position: relative;
  margin: 6px var(--gutter) 0;
}
.text-input {
  width: 100%;
  height: 52px;
  padding: 0 92px 0 16px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-input);
  transition: border-color var(--dur-select) var(--ease-out);
}
.text-input::placeholder { color: var(--color-text-faint); }
.text-input:focus { border-color: var(--color-accent); }

.text-tools {
  position: absolute;
  top: 0;
  right: 6px;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.text-counter {
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
}
.text-counter.is-full { color: var(--color-danger); font-weight: 600; }

.text-clear {
  position: relative;
  width: 44px;                                /* 누르는 범위 44px, 보이는 동그라미는 안쪽 18px */
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  opacity: 0;
  scale: .6;
  pointer-events: none;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-out);
}
.text-clear::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--color-tab);
}
.text-clear::after {
  content: "×";
  position: relative;
  color: var(--color-text-soft);
  font-size: 16px;
  line-height: 1;
}
.text-field.has-value .text-clear { opacity: 1; scale: 1; pointer-events: auto; }

.text-hint {
  margin: 8px var(--gutter) 0;
  color: var(--color-text-soft);
  font-size: var(--font-size-xs);
}

/* 문구 입력 중, 키보드 때문에 미리보기가 가려지면 보이는 화면 위쪽에 뜨는 작은 미리보기 */
.mini-preview {
  position: fixed;
  top: calc(var(--mini-top, 0px) + 10px);
  right: 10px;
  z-index: 8;
  width: min(38vw, 168px);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  background: var(--color-preview);
  box-shadow: 0 8px 28px rgba(31, 29, 26, .18), 0 0 0 1px rgba(31, 29, 26, .06);
  overflow: hidden;
  container-type: inline-size;                /* 안쪽 문구 글자 크기를 작은 미리보기 폭에 맞춤 */
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px) scale(.96);
  transition: opacity var(--dur-select) var(--ease-out), transform var(--dur-select) var(--ease-out);
}
.mini-preview.is-visible { opacity: 1; transform: none; }
.mini-preview * { animation: none !important; }


/* ── 총 금액 + 주문하기 (항상 화면 아래에 붙어 있음) ── */
.checkout {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: auto;                           /* 남는 공간은 선택지와 금액 사이로 → 금액·주문은 늘 화면 맨 아래 */
  display: flex;
  align-items: center;
  gap: 8px;                                   /* 버튼 사이. 금액과 버튼 사이는 .total 의 오른쪽 여백까지 더해 16px */
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-line);
  background: var(--color-surface);
}

.total { display: flex; flex-direction: column; flex: 0 0 auto; margin-right: auto; padding-right: 8px; }   /* 금액은 줄어들지 않음 (글씨가 커지면 버튼이 양보) */
.total-label { color: var(--color-text-soft); font-size: var(--font-size-xs); }
.total-amount {
  display: inline-block;
  font-size: var(--font-size-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;          /* 숫자 폭을 같게 해서 굴러갈 때 흔들리지 않음 */
  transform-origin: left center;
  white-space: nowrap;
}
.total-amount[data-bump="a"] { animation: bump-a var(--dur-price) var(--ease-out); }
.total-amount[data-bump="b"] { animation: bump-b var(--dur-price) var(--ease-out); }

/* 주문 버튼은 정해진 폭(좁으면 줄어듦). 남는 폭은 금액 옆 여백으로 → 금액과 버튼이 붙어 보이지 않게 */
.order-btn { flex: 0 1 var(--order-btn-width); min-width: 0; padding: 0 16px; }
.order-label {
  flex: 0 0 auto;                             /* 줄어들지 않음 → JS(fitCheckout)가 넘침을 잴 수 있음 */
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.order-sub { font-size: var(--font-size-xs); font-weight: 600; opacity: .72; }   /* 위 작은 줄: '선택한 제품' / '장바구니 3개' */

/* 주문 바의 담기·취소 버튼: 작은 네모에 아이콘 + 그 아래 짧은 이름 (자리가 좁으면 아이콘만) */
.btn.bar-btn {                                /* .btn 의 기본 크기·글자보다 우선하도록 두 클래스로 */
  flex: 0 0 auto;
  flex-direction: column;
  gap: 2px;
  min-width: var(--bar-btn-size);
  padding: 0 6px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.1;
}
.bar-btn svg, .icon-btn svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bar-btn:disabled { opacity: .35; }

/* 장바구니 아이콘 위 담은 개수 (바뀔 때 살짝 튐) */
.cart-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-text);
  box-shadow: 0 0 0 2px var(--color-surface);
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  animation: pop-in var(--dur-select) var(--ease-out) backwards;
}
.cart-count[data-bump="a"] { animation: count-a var(--dur-price) var(--ease-spring); }
.cart-count[data-bump="b"] { animation: count-b var(--dur-price) var(--ease-spring); }

/* 주문하기 글자가 넘치면 JS(fitCheckout)가 붙임: 담기·취소를 이름 없이 동그란 아이콘만 */
.checkout.is-compact .btn.bar-btn { min-width: 44px; padding: 0; }
.checkout.is-compact .bar-label { display: none; }

/* 주문 버튼 글자가 바뀔 때 (선택한 제품 ↔ 장바구니 n개 ↔ 변경 완료) 아래에서 살짝 올라오며 나타남 */
.order-label[data-swap="a"] { animation: label-a var(--dur-select) var(--ease-out); }
.order-label[data-swap="b"] { animation: label-b var(--dur-select) var(--ease-out); }

/* 장바구니 상품을 고치는 중에는 담기 대신 '취소' */
.checkout[data-mode="edit"] .cart-btn { display: none; }

/* 담은 상품 카드: 주문 바 바로 위에 떠오름 (썸네일 | 무엇을 담았는지 | 장바구니 보기) */
.added-card {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(100% + 10px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 10px;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-accent-text);
  box-shadow: var(--shadow-card);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transition: opacity var(--dur-select) var(--ease-out), transform var(--dur-select) var(--ease-out);
}
.added-card.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.added-card .thumb { --thumb-size: 44px; }
.added-body { flex: 1 1 auto; min-width: 0; }
.added-title { margin: 0; font-size: var(--font-size-sm); font-weight: 700; }
.added-card .opt-chips {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: rgba(255, 255, 255, .78);
}
.added-card .opt-key { color: rgba(255, 255, 255, .55); }
.added-go {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .14);
  font-size: var(--font-size-sm);
  font-weight: 700;
  transition: transform var(--dur-press) var(--ease-out);
}
.added-go:active { transform: scale(var(--press-scale)); }
/* 글자만 있는 안내 (고치는 중, 다른 상품 더 담기) */
.added-card.is-text { justify-content: center; padding: 12px 16px; text-align: center; }

/* 담기 효과: 미리보기 복사본이 작아지며 담기 버튼으로 들어감 (위치는 JS가 --fly-x/y/scale 로 넘김) */
.fly-thumb {
  position: fixed;
  z-index: 9;
  border-radius: var(--radius-lg);
  background: var(--color-preview);
  overflow: hidden;
  container-type: inline-size;                /* 안쪽 문구 글자 크기를 복사본 폭에 맞춤 */
  pointer-events: none;
  animation: fly-to-cart var(--dur-fly) var(--ease-fly) forwards;
}
.fly-thumb * { animation: none !important; }


/* =========================================================
   버튼
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-md);
  font-weight: 700;
  white-space: nowrap;
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-select) var(--ease-out), background-color var(--dur-select) var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(var(--press-scale)); }
.btn:disabled { cursor: default; }
.btn-primary { background: var(--color-accent); color: var(--color-accent-text); }
.btn-primary:disabled { opacity: .35; }
.btn-ghost { background: var(--color-tab); color: var(--color-text); }
.btn-block { width: 100%; }


/* =========================================================
   주문 창
   ========================================================= */
/* 주문 창 자리 = '실제로 보이는 화면'(--vvt 부터 --vvh 높이, JS syncViewport).
   키보드가 올라오면 이 영역이 키보드 위까지로 줄어서 창의 아래 끝이 키보드 바로 위에 붙음 */
.sheet {
  position: fixed;
  top: var(--vvt, 0px);
  left: 0;
  right: 0;
  height: var(--vvh, 100%);
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* 어두운 막은 주문 창 자리(키보드 위)와 상관없이 화면 전체를, 위아래로 넉넉히 덮음
   (키보드 뒤나 아이폰이 화면을 밀어 올린 틈으로 밝은 사이트 화면이 비치지 않게) */
.sheet-backdrop {
  position: fixed;
  top: -50vh;
  bottom: -50vh;
  left: 0;
  right: 0;
  background: var(--color-backdrop);
  opacity: 0;
  transition: opacity var(--dur-sheet) var(--ease-out);
}

/* 주문 창의 흰 바탕을 창 아래(키보드 뒤)까지 이어 붙임 → 반투명한 아이폰 키보드 너머로도 흰색만 비침.
   입력칸 위치(키보드 위)는 그대로. 키보드가 없을 때는 화면 밖이라 안 보임 */
.sheet::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 100vh;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--color-surface);
  pointer-events: none;
}
.sheet.is-open .sheet-backdrop { opacity: calc(1 - var(--drag-fade, 0)); }   /* 아래로 끄는 만큼 옅어짐 */

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  max-height: calc(100% - 24px);              /* 보이는 화면(키보드 위)보다 조금 작게 → 위로 넘치면 창 안에서 스크롤 */
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-sheet);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform var(--dur-sheet) var(--ease-out);
}
.sheet.is-open .sheet-panel { transform: translateY(var(--drag, 0px)); }   /* --drag: 아래로 끄는 거리 (JS가 넣음) */
/* 끄는 동안은 손가락을 바로 따라오게 전환 효과를 끔. 놓으면 지금 위치에서 닫히거나 제자리로 부드럽게 이어짐 */
.sheet.is-dragging .sheet-panel,
.sheet.is-dragging .sheet-backdrop { transition: none; }

.sheet-grabber {
  width: 36px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: var(--color-line);
}

/* 창 안의 화면: data-view 가 form(주문 정보) / success(완료) / orders(내 주문) 중 하나만 보임 */
.sheet-view { display: none; }
.sheet-panel[data-view="form"] .sheet-view-form,
.sheet-panel[data-view="orders"] .sheet-view-orders { display: block; }
.sheet-panel[data-view="success"] .sheet-view-success { display: block; animation: pop-in var(--dur-sheet) var(--ease-out) backwards; }

.sheet-title { margin: 0 0 12px; font-size: var(--font-size-lg); font-weight: 700; }

.sheet-order {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-page);
  font-size: var(--font-size-sm);
}
.sheet-order-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.sheet-order-head span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet-order-lines { margin: 6px 0 0; color: var(--color-text-soft); white-space: pre-line; }   /* 요약 글의 줄바꿈 그대로 */
.order-line + .order-line { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-line); }

/* 제목 줄: 왼쪽 '주문 정보', 오른쪽 '내 주문' (주문한 적이 있을 때만) */
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sheet-link {
  min-height: 44px;
  margin: -12px -8px 0 0;
  padding: 0 8px;
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 상품 썸네일 (바탕 + 고른 선택지 이미지를 작게 겹침) */
.thumb {
  position: relative;
  display: block;                             /* span 이라 크기가 0 이 되지 않게 */
  flex: 0 0 auto;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: var(--radius-sm);
  background: var(--color-preview);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  overflow: hidden;
  container-type: inline-size;                /* 문구 글자 크기를 썸네일 폭에 맞춤 */
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 상품 내용: 주문서 형식으로 한 줄에 하나씩 (사용자가 정한 형식)
     세로형 액자
     왼쪽 : ● 레드          */
.opt-chips { display: block; color: var(--color-text-soft); font-size: var(--font-size-sm); line-height: 1.55; }
.opt { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.opt-kind { color: var(--color-text); font-weight: 600; }
.opt-key { color: var(--color-text-faint); white-space: pre; }
/* 담은 상품 알림 카드는 좁은 한두 줄이라 조각을 옆으로 이어 붙임 */
.added-card .opt { display: inline-flex; margin-right: 10px; }
.added-card .opt-kind { color: inherit; }
.opt-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

/* 주문 창의 상품 목록: 썸네일 | 이름·금액, 옵션, 수량·수정·빼기 */
.order-items { margin: 0; padding: 0; list-style: none; }
.order-item {
  position: relative;
  display: grid;
  grid-template-columns: var(--thumb-size) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.order-item + .order-item { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-line); }
.order-item-body { min-width: 0; }
.order-item-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 2px; font-weight: 700; }
.order-item-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-item-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.order-item-links { display: flex; align-items: center; }
/* 방금 고친 상품을 잠깐 강조 */
.order-item.is-updated::after {
  content: "";
  position: absolute;
  inset: -6px -8px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  opacity: 0;
  pointer-events: none;
  animation: flash var(--dur-flash) var(--ease-out);
}

/* 완료 화면·내 주문의 상품 (썸네일이 있으면 옆에) */
.order-line.has-thumb { display: grid; grid-template-columns: var(--thumb-size) minmax(0, 1fr); gap: 12px; align-items: start; }
.order-line-body { min-width: 0; }
.order-line .sheet-order-head { margin-bottom: 2px; }

.qty {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1.5px var(--color-line);
}
.qty-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 36px;
  font-size: 18px;
  line-height: 1;
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-select) var(--ease-out);
}
.qty-btn::after { content: ""; position: absolute; inset: -4px 0; }   /* 누르는 범위는 위아래로 넓혀 44px */
.qty-btn:active:not(:disabled) { transform: scale(var(--press-scale)); }
.qty-btn:disabled { opacity: .3; cursor: default; }
/* 장바구니 상품 수량 1에서 − 대신 휴지통 (누르면 빠짐) */
.qty-trash { display: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.qty-minus.is-trash .qty-trash { display: block; }
.qty-minus.is-trash .qty-minus-sign { display: none; }
.qty-minus.is-trash { color: var(--color-danger); }
.qty-value { min-width: 24px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

.order-item-edit,
.order-item-remove {
  min-height: 44px;
  margin: -4px 0;
  padding: 0 8px;
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.order-item-remove { margin-right: -8px; color: var(--color-text-faint); font-weight: 400; }

/* 목록 아래: 지금 꾸민 상품도 추가 / 다른 상품 더 담기 */
.order-extra {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1.5px dashed var(--color-line);
  border-radius: var(--radius-sm);
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: transform var(--dur-press) var(--ease-out);
}
.order-extra:active { transform: scale(.98); }

/* 합계 (상품이 둘 이상일 때) */
.order-sum {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-line);
  font-weight: 700;
}
.order-sum strong { font-size: var(--font-size-lg); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 보내는 중에는 목록을 건드리지 못하게 */
.sheet-order.is-locked { pointer-events: none; opacity: .6; }

.fields { margin: 0; padding: 0; border: 0; min-width: 0; }
.fields:disabled { opacity: .6; }

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; margin-bottom: 6px; color: var(--color-text-soft); font-size: var(--font-size-sm); font-weight: 600; }
.field-label em { font-style: normal; font-weight: 400; color: var(--color-text-faint); }
.field-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-input);
  transition: border-color var(--dur-select) var(--ease-out);
}
.field-input:focus { border-color: var(--color-accent); }
.field-input.is-invalid { border-color: var(--color-danger); }
.field-textarea { height: auto; min-height: 72px; padding: 12px 14px; resize: none; line-height: 1.4; }

/* 주소: [우편번호][주소 찾기] / 기본 주소 / 상세 주소 */
.addr-row { display: flex; gap: 8px; margin-bottom: 8px; }
.addr-zip { flex: 1 1 auto; min-width: 0; }
.addr-find { flex: 0 0 auto; height: 48px; gap: 5px; padding: 0 16px 0 13px; border-radius: var(--radius-md); font-size: var(--font-size-sm); }
.addr-find svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#addressField .field-input + .field-input { margin-top: 8px; }

/* =========================================================
   크게 보기: 흐리게 비치는 바탕 위에 흰 카드를 화면 가득 띄우고 손가락으로 확대
   - 위: 상품 이름·모양 + 닫기 / 가운데: 흰 카드(위아래 줄 사이를 꽉 채움) / 아래: 안내 알약 ↔ 확대하면 '원래 크기' 알약
   - 카드는 정사각형이 아님: 제품이 실제로 차지하는 부분(바탕 그림의 불투명한 부분)이 카드에 꽉 차게
     JS(layoutViewerFit)가 그림 칸(.viewer-fit)의 크기·자리를 정함 → 세로형은 위아래로 길게, 처음부터 확 커 보임
     (예전엔 미리보기와 같은 정사각형 카드라 답답하고 크게 본다는 느낌이 거의 없다는 지적)
   - 열 때: 제품 그림(.viewer-fit)이 미리보기 자리(--from-*)에서 날아와 커지고, 카드·바탕은 옅게 나타남. 닫을 때 반대로
   - 확대·이동은 .viewer-canvas 의 transform 만 (--zx, --zy, --zs 를 JS 가 넣음). 카드 밖으로는 안 넘침
   (그 전엔 흰 화면 가득에 버튼만 떠 있어서 밋밋하다는 지적)
   ========================================================= */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 25;                                /* 주문 창·주소 찾기보다 위 */
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  touch-action: none;                         /* 손가락 조작은 모두 직접 처리 (페이지 스크롤·확대 없음) */
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
.viewer.is-closing { pointer-events: none; }
.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--viewer-backdrop);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  backdrop-filter: blur(22px) saturate(1.15);
}
.viewer-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--viewer-bar);
  padding: 0 calc(var(--gutter) - 4px) 0 var(--gutter);
}
.viewer-title { flex: 1 1 auto; min-width: 0; }
.viewer-name { margin: 0; font-size: var(--font-size-lg); font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
.viewer-kind { margin: 1px 0 0; color: var(--color-text-soft); font-size: var(--font-size-sm); line-height: 1.3; }
.viewer-kind:empty { display: none; }
.viewer-stage {
  position: relative;
  justify-self: center;
  width: min(100% - 2 * var(--gutter), var(--viewer-max-width));
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;                         /* 둥근 모서리로 확대한 그림을 깔끔하게 자름 */
}
/* 흰 카드 바탕 (그림과 따로 두어, 열고 닫을 때 카드는 옅어지기만 하고 그림은 날아다닐 수 있게) */
/* 열고 닫는 동안은 그림이 카드 밖(미리보기 자리)에서 날아오므로 자르지 않음.
   단 확대한 채로 닫을 때는 확대된 그림이 카드 밖으로 드러나지 않게 계속 자름(is-clip, JS) */
.viewer.is-opening .viewer-stage,
.viewer.is-closing:not(.is-clip) .viewer-stage { overflow: visible; }
.viewer-card {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--color-preview);
  box-shadow: var(--shadow-viewer);
}
.viewer-canvas {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  transform: translate(var(--zx, 0px), var(--zy, 0px)) scale(var(--zs, 1));
  will-change: transform;
}
/* 제품 그림 칸: 크기·자리는 JS 가 정함 (제품이 카드에 꽉 차게). 정사각형이라 미리보기와 같은 그림 그대로 */
.viewer-fit {
  position: absolute;
  left: 0;
  top: 0;
  container-type: inline-size;                /* 문구 글자 크기를 이 칸 폭 기준으로 */
  transform-origin: 0 0;
}
.viewer-canvas.is-settling { transition: transform var(--dur-zoom-settle) var(--ease-out); }
.viewer-fit * { animation: none !important; }   /* 복사한 그림 안의 효과는 끔 (그림 칸 자체의 날아오는 효과는 남김) */
.viewer-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  color: var(--color-text);
  transition: transform var(--dur-press) var(--ease-out);
}
.viewer-close { position: relative; }
.viewer-close::after { content: ""; position: absolute; inset: -2px; }   /* 누르는 범위 44px */
.viewer-close:active { transform: scale(var(--press-scale)); }
.viewer-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* 아래 줄: 처음엔 안내 알약(어두운 바탕), 확대하면 그 자리에 '원래 크기' 알약(흰 바탕)이 바뀌어 나타남 */
.viewer-foot {
  position: relative;
  display: grid;
  place-items: center;
  height: var(--viewer-bar);
}
.viewer-hint,
.viewer-reset {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  margin: 0;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: opacity var(--dur-select) var(--ease-out), transform var(--dur-select) var(--ease-out);
}
.viewer-hint {
  background: var(--viewer-hint-bg);
  color: #fff;
  pointer-events: none;
}
.viewer-reset {
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  color: var(--color-text);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}
.viewer-reset svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.viewer-reset:active { transform: scale(var(--press-scale)); }
.viewer.is-touched .viewer-hint,
.viewer.is-zoomed .viewer-hint { opacity: 0; transform: translateY(6px); }   /* 한 번 만지면 안내는 사라짐 */
.viewer.is-zoomed .viewer-reset { opacity: 1; transform: none; pointer-events: auto; }

.viewer.is-opening .viewer-fit { animation: viewer-in var(--dur-viewer) var(--ease-glide) backwards; }
.viewer.is-closing .viewer-fit { animation: viewer-out var(--dur-viewer) var(--ease-glide) forwards; }
.viewer.is-opening .viewer-card { animation: viewer-card-in var(--dur-viewer) var(--ease-glide) backwards; }
.viewer.is-closing .viewer-card { animation: viewer-card-out var(--dur-viewer) var(--ease-glide) forwards; }
.viewer.is-opening .viewer-backdrop { animation: fade-in var(--dur-viewer) var(--ease-out) backwards; }
.viewer.is-opening .viewer-head { animation: viewer-head-in var(--dur-viewer) var(--ease-out) 60ms backwards; }
.viewer.is-opening .viewer-foot { animation: viewer-foot-in var(--dur-viewer) var(--ease-out) 90ms backwards; }
.viewer.is-closing :is(.viewer-backdrop, .viewer-head, .viewer-foot) { animation: fade-out calc(var(--dur-viewer) * .7) var(--ease-out) forwards; }
@keyframes viewer-in { from { transform: translate(var(--from-x), var(--from-y)) scale(var(--from-s)); } }
@keyframes viewer-out { to { transform: translate(var(--from-x), var(--from-y)) scale(var(--from-s)); } }
/* 폰 가로처럼 낮은 화면: 위아래 줄이 높이를 먹으면 미리보기보다 작아져서, 이름은 왼쪽 위·닫기는 오른쪽 위 빈 곳으로,
   안내 알약은 카드 아래쪽 위에 띄우고 카드는 화면 높이를 다 씀 */
@media (orientation: landscape) and (max-height: 500px) {
  .viewer { grid-template-rows: 1fr; grid-template-columns: 1fr auto 1fr; }
  .viewer-head { grid-area: 1 / 1 / 2 / 4; align-self: start; padding-top: 8px; }
  .viewer-title { flex: 0 1 auto; max-width: calc((100vw - var(--viewer-land-width)) / 2 - var(--gutter) - 8px); }
  .viewer-close { margin-left: auto; }   /* 닫기를 오른쪽 끝으로 */
  .viewer-stage { grid-area: 1 / 2; width: var(--viewer-land-width); height: calc(100% - 16px); align-self: center; }
  .viewer-foot { grid-area: 1 / 2; align-self: end; height: auto; margin-bottom: 20px; z-index: 1; pointer-events: none; }
}
@keyframes viewer-card-in { from { opacity: 0; transform: scale(.94); } }
@keyframes viewer-card-out { to { opacity: 0; transform: scale(.94); } }
@keyframes viewer-head-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes viewer-foot-in { from { opacity: 0; transform: translateY(10px); } }

/* 주소 찾기 창: 화면 전체(키보드 뒤까지)를 덮으며 아래에서 올라옴 (안에 카카오 우편번호 검색)
   - 위치는 맨 위(0)에 고정. 보이는 영역의 위치(--vvt)를 따라가게 했더니 쓸 때 아이폰 바운스를 따라 창이 덜덜 떨렸음
   - 높이도 키보드 위까지가 아니라 화면 끝까지. 아이폰은 키보드가 떠 있으면 키보드 뒤를 보여주려고 화면을 아래로
     더 내릴 수 있는데, 키보드 위까지만 있으면 그 아래 흰 덧댐·바탕이 드러나고 덧댐은 잡히지 않아 다시 못 올렸음 */
.addr-layer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;                                /* 주문 창 위 */
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--color-surface);
  transform: translateY(100%);
  transition: transform var(--dur-sheet) var(--ease-out);
}
.addr-layer.is-open { transform: none; }
/* 주소 찾기가 열려 있는 동안 끝까지 당겨 튕길 때 보이는 페이지 바탕도 흰색으로 (베이지가 드러나지 않게) */
html.is-addr, html.is-addr body { background: var(--color-surface); }
.addr-layer-head {                           /* 검색 결과 자리를 넓히려고 낮게 (44px) */
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: env(safe-area-inset-top) 6px 0 16px;
  border-bottom: 1px solid var(--color-line);
  box-sizing: content-box;
  touch-action: none;                         /* 제목 줄을 쓸어도 뒤 페이지가 움직이지 않게 (검색 결과는 안쪽 창이 따로 스크롤) */
}
.addr-layer-title { margin: 0; font-size: var(--font-size-md); font-weight: 700; }
.addr-layer-close { min-height: 44px; padding: 0 12px; font-weight: 600; color: var(--color-text-soft); }
.addr-layer-body { position: relative; flex: 1 1 auto; min-height: 0; }
.addr-embed { position: absolute; inset: 0; }
.addr-loading { margin: 0; padding: 32px 20px; color: var(--color-text-soft); text-align: center; }

/* 자체 주소 검색 (CONFIG.ADDRESS_API_KEY가 있을 때): [돋보기 검색칸 ×] / 결과 목록
   - 창이 키보드 뒤까지 덮으므로, 목록 아래에 키보드에 가려지는 높이(--addr-kb, JS syncAddrKeyboard)만큼 여백을 둬 마지막 결과까지 올려 볼 수 있게 */
.addr-search { position: absolute; inset: 0; display: flex; flex-direction: column; }
.addr-bar {
  flex: 0 0 auto;
  position: relative;
  margin: 12px var(--gutter) 4px;
}
.addr-bar > svg {
  position: absolute; left: 14px; top: 50%;
  width: 20px; height: 20px; margin-top: -10px;
  fill: none; stroke: var(--color-text-faint); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.addr-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 44px 0 42px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-input);           /* 16px 이상: 아이폰 확대 방지 */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-select) var(--ease-out);
}
.addr-input:focus { border-color: var(--color-accent); outline: none; }
.addr-input::-webkit-search-cancel-button, .addr-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.addr-clear {                                  /* 검색어 지우기: 회색 동그라미 안 × (누르는 자리는 44px) */
  position: absolute; right: 2px; top: 2px;
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
}
.addr-clear::before, .addr-clear::after {
  content: ""; position: absolute; left: 50%; top: 50%;
}
.addr-clear::before { width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--color-tab); }
.addr-clear::after {
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  background:
    linear-gradient(45deg, transparent calc(50% - 1px), var(--color-text-soft) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(-45deg, transparent calc(50% - 1px), var(--color-text-soft) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
.addr-clear[hidden] { display: none; }
.addr-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden auto;                       /* 세로로만 스크롤 (옆으로 1px도 넘치지 않게) */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--addr-kb, 0px) + env(safe-area-inset-bottom) + 16px);
}
.addr-list { margin: 0; padding: 0; list-style: none; }
.addr-list li + li .addr-item { border-top: 1px solid var(--color-line); }
.addr-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 13px var(--gutter);
  text-align: left;
  transition: background-color var(--dur-select) var(--ease-out);
}
.addr-item:active { background: var(--color-page); }
.addr-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.addr-road { font-size: var(--font-size-md); line-height: 1.4; color: var(--color-text); word-break: keep-all; overflow-wrap: anywhere; }
.addr-bd { color: var(--color-text-soft); }
.addr-jibun { font-size: var(--font-size-sm); line-height: 1.4; color: var(--color-text-faint); word-break: keep-all; overflow-wrap: anywhere; }
.addr-jibun em {                               /* '지번' 작은 꼬리표 */
  display: inline-block;
  margin-right: 5px;
  padding: 0 5px;
  border: 1px solid var(--color-line);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  font-style: normal;
  line-height: 17px;
  vertical-align: 1px;
}
.addr-item b { font-weight: 700; color: var(--color-text); }
.addr-zipno {
  flex: 0 0 auto;
  padding-top: 1px;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-soft);
}
.addr-note { margin: 0; padding: 20px var(--gutter); color: var(--color-text-soft); font-size: var(--font-size-sm); text-align: center; }
.addr-note.is-busy { animation: addr-busy 1.2s var(--ease-out) infinite alternate; }
@keyframes addr-busy { from { opacity: 1; } to { opacity: .45; } }
.addr-guide { padding: 20px var(--gutter); }
.addr-guide-title { margin: 0 0 10px; font-size: var(--font-size-sm); font-weight: 700; color: var(--color-text-soft); }
.addr-guide dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: var(--font-size-sm); line-height: 1.4; }
.addr-guide dt { color: var(--color-text-soft); }
.addr-guide dd { margin: 0; color: var(--color-text); }
.addr-empty { padding: 28px var(--gutter); text-align: center; color: var(--color-text-soft); font-size: var(--font-size-sm); line-height: 1.5; }
.addr-empty p { margin: 0 0 6px; }
.addr-empty-title { color: var(--color-text); font-size: var(--font-size-md); font-weight: 600; }
.addr-empty-title.is-error { color: var(--color-danger); }
.addr-empty .btn, .addr-actions { margin-top: 10px; }
.addr-actions { display: flex; justify-content: center; gap: 8px; }
.addr-actions .btn { margin-top: 0; }
.addr-empty .btn { height: 40px; padding: 0 16px; font-size: var(--font-size-sm); }
.field-error { display: block; min-height: 0; margin-top: 4px; color: var(--color-danger); font-size: var(--font-size-xs); }
.field-error:empty { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.privacy {
  margin: 4px 0 10px;
  color: var(--color-text-soft);
  font-size: var(--font-size-xs);
  line-height: 1.5;
}

.consent {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
/* 주문 제작 동의: 내용 전체가 체크 문구라 여러 줄 → 체크 칸은 첫 줄에 맞춤 */
.consent-text { font-weight: 600; }
.consent-text { line-height: 1.45; word-break: keep-all; }

/* 주문 제작 안내 상자 (체크 바로 위, 한 항목씩 짧게) */
.consent-notice {
  margin: 8px 0 2px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-page);
  box-shadow: inset 0 0 0 1px var(--color-line);
  font-size: var(--font-size-xs);
  line-height: 1.55;
  word-break: keep-all;
}
.consent-notice-title { margin: 0 0 6px; font-size: var(--font-size-sm); font-weight: 700; }
.consent-points { margin: 0; padding: 0; list-style: none; color: var(--color-text-soft); }
.consent-points li { position: relative; padding-left: 12px; }
.consent-points li + li { margin-top: 5px; }
.consent-points li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

/* 거래 조건 한 줄 (주문 창 상품 목록 바로 아래: 배송비 · 받기까지 · 결제) */
.order-terms {
  margin: -10px 0 18px;
  white-space: pre-line;                      /* products.json 의 \n 에서 줄을 바꿈 */
  color: var(--color-text-soft);
  font-size: var(--font-size-xs);
  line-height: 1.5;
  text-align: right;
  word-break: keep-all;
}

/* 판매자 정보 (주문 창 맨 아래 · 둘러보기 맨 아래) */
.biz-info {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--color-line);
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
  line-height: 1.6;
  word-break: keep-all;
}
.biz-line { margin: 0; }
.biz-item { overflow-wrap: anywhere; }      /* 긴 주소·이메일이 좁은 화면을 넘치지 않게 */
.biz-links { display: flex; gap: 14px; margin: 6px 0 0; }
.biz-link {
  min-height: 32px;
  padding: 0;
  color: var(--color-text-soft);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 둘러보기: 마지막 디자인 밑에 붙은 짧은 칸 (끝에 맞춰 멈춤) */
.gallery-biz {
  margin: 0;
  padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  scroll-snap-align: end;
  text-align: center;
}
.gallery-biz .biz-links { justify-content: center; }
/* 둘러보기 맨 아래 고정 줄: 이용 안내 · 개인정보 처리방침 (넘겨도 늘 보임) */
.gallery-legal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom);
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 0 var(--gutter) 4px;
  pointer-events: none;                       /* 빈 곳은 아래 디자인을 쓸어 넘길 수 있게 */
}
.gallery-legal .biz-link { pointer-events: auto; color: var(--color-text-faint); font-weight: 500; }
.gallery.is-leaving .gallery-legal { animation: fade-out var(--dur-view-out) var(--ease-in) forwards; }
.gallery.is-entering .gallery-legal { animation: fade-in var(--dur-view) var(--ease-out) var(--view-late) backwards; }
/* 고정 줄 자리만큼: 마지막 판매자 정보 칸 아래 여백, 첫 장 화살표는 그 위로 */
.gallery-biz { padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
.consent-box {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--color-line);
  border-radius: 7px;
  transition: background-color var(--dur-select) var(--ease-out), border-color var(--dur-select) var(--ease-out);
}
.consent-box::after {
  content: "";
  position: absolute;
  left: 6.5px;
  top: 2.5px;
  width: 5px;
  height: 10px;
  border: solid var(--color-accent-text);
  border-width: 0 2px 2px 0;
  rotate: 45deg;
  opacity: 0;
  scale: .5;
  transition: opacity var(--dur-select) var(--ease-out), scale var(--dur-select) var(--ease-spring);
}
.consent input:checked + .consent-box { background: var(--color-accent); border-color: var(--color-accent); }
.consent input:checked + .consent-box::after { opacity: 1; scale: 1; }
.consent input:focus-visible + .consent-box { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.consent.is-invalid .consent-box { border-color: var(--color-danger); }
/* 동의 없이 보내려 할 때 흔들림 (a/b 를 번갈아 붙여 매번 다시 재생) */
.consent[data-nudge="a"] { animation: nudge-a var(--dur-nudge) var(--ease-out); }
.consent[data-nudge="b"] { animation: nudge-b var(--dur-nudge) var(--ease-out); }

.form-message {
  min-height: 0;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-page);
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
}
.form-message:empty { display: none; }
.form-message.is-error { background: #FDF0EA; color: var(--color-danger); }

.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn-ghost { flex: 0 0 auto; }
.sheet-actions .submit-btn { flex: 1 1 auto; }

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.is-sending .spinner { display: inline-block; }

/* 완료 화면 */
.sheet-view-success { text-align: center; padding-top: 8px; }
.success-mark {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 4px auto 14px;
  border-radius: 50%;
  background: var(--color-success);
}
.success-mark::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 13px;
  width: 12px;
  height: 22px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  rotate: 45deg;
}
.success-title { margin-bottom: 14px; }
.success-label { margin: 0; color: var(--color-text-soft); font-size: var(--font-size-sm); }
.success-number {
  margin: 2px 0 16px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sheet-view-success .sheet-order { text-align: left; }
.success-message { margin: 0 0 6px; font-weight: 600; }
.success-demo { margin: 0 0 12px; color: var(--color-danger); font-size: var(--font-size-xs); }
.success-hint { margin: 0; color: var(--color-text-soft); font-size: var(--font-size-xs); }
.success-terms { white-space: pre-line; margin: 8px 0 0; color: var(--color-text-soft); font-size: var(--font-size-xs); line-height: 1.5; word-break: keep-all; }
.sheet-view-success .btn-block { margin-top: 12px; }

/* 내 주문 목록 */
.orders-note { margin: -6px 0 14px; color: var(--color-text-soft); font-size: var(--font-size-sm); }
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.orders-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-page);
  font-size: var(--font-size-sm);
}
.orders-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.orders-no {
  font-size: var(--font-size-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.orders-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.orders-meta { margin: 2px 0 0; color: var(--color-text-soft); font-weight: 600; }
.orders-items { margin-top: 10px; }
.orders-clear {
  display: block;
  min-height: 44px;
  margin: 8px auto 0;
  padding: 0 12px;
  color: var(--color-text-faint);
  font-size: var(--font-size-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.orders-clear.is-confirming { color: var(--color-danger); font-weight: 600; text-decoration: none; }


/* =========================================================
   오류 / 기타
   ========================================================= */
.app-error {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--color-page);
  text-align: center;
}
.app-error-title { margin: 0; font-size: var(--font-size-lg); font-weight: 700; }
.app-error-detail { margin: 0 0 12px; color: var(--color-text-soft); font-size: var(--font-size-sm); white-space: pre-line; }

/* 로컬에서만 보이는 products.json 경고 알림 */
.dev-toast {
  position: fixed;
  left: 12px;
  top: calc(12px + env(safe-area-inset-top));
  z-index: 20;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #3B2A00;
  color: #FFE8A3;
  font-size: var(--font-size-xs);
  box-shadow: var(--shadow-raised);
  animation: fade-in 200ms both;
}

.noscript { padding: 24px; text-align: center; }


/* =========================================================
   큰 화면 중 좌우 배치가 아닌 것: 가운데 정렬된 폰 크기 칸
   - 폭 560~719px (폭이 모자라 좌우로 나누면 미리보기가 너무 작아짐. 예: 일부 폴드를 편 화면)
   - 720px 이상이어도 세로로 긴 화면 (태블릿을 세워 든 것 등)
   ========================================================= */
@media (min-width: 560px) and (max-width: 719px) and (min-height: 601px),
       (min-width: 560px) and (min-height: 601px) and (max-aspect-ratio: 79/100) {
  body { padding: 24px 0; }
  .app { min-height: calc(100dvh - 48px); }
  .panel { border-radius: var(--radius-lg); }
  .checkout { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
  .sheet { align-items: center; }
  .sheet::after { display: none; }            /* 가운데 뜨는 창이라 아래로 이어 붙일 필요 없음 */
  .sheet-panel { border-radius: var(--radius-lg); max-width: 420px; margin-bottom: 0; }
}


/* =========================================================
   좌우 배치: 미리보기는 왼쪽, 머리줄·선택지·요약·금액·주문은 오른쪽
   - 휴대폰을 가로로 돌렸을 때 (낮고 넓은 화면)
   - 폴더블(갤럭시 Z 폴드 등)을 펼쳤을 때처럼 정사각형에 가깝거나 가로가 넓고, 폭이 720px 이상인 화면, 노트북 브라우저
     (720px 보다 좁으면 좌우로 나눴을 때 미리보기가 300px 아래로 작아지고 위아래가 텅 비어서 가운데 칸이 나음)
   폴드를 펴고 접으면 화면 크기가 바뀌므로 바 타입 ↔ 좌우 배치가 저절로 바뀜
   ========================================================= */
@media (orientation: landscape) and (max-height: 600px), (min-width: 720px) and (min-aspect-ratio: 4/5) {
  :root {
    /* 미리보기 크기 = 아래 셋 중 가장 작은 것
       ⓪ --wide-preview-cap (노트북처럼 아주 큰 화면에서 오른쪽 영역이 최소 폭까지 눌리지 않게)
       ① 화면 높이 - 위아래 여백 - 제품군 버튼 줄(46px) - 홈 바 등 안전 영역
       ② 화면 폭(최대 --wide-max-width) - 오른쪽 영역 최소 폭 - 탭 열 - 좌우 여백 - 안전 영역 */
    --preview-max: max(var(--preview-min-size), min(
      var(--wide-preview-cap),
      calc(100svh - 2 * var(--gap) - 46px - env(safe-area-inset-top) - env(safe-area-inset-bottom)),
      calc(min(100vw, var(--wide-max-width)) - var(--wide-panel-min) - var(--tab-width) - var(--tab-pop) - 2 * var(--gutter) - env(safe-area-inset-left) - env(safe-area-inset-right))
    ));
  }
  /* 왼쪽 칸 = 미리보기(위아래 두 줄을 차지), 오른쪽 칸 = 머리줄(위) + 선택 영역(아래) */
  .app {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    max-width: var(--wide-max-width);
    height: 100dvh;
    min-height: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  .stage {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--gap) var(--gutter) calc(var(--gap) + env(safe-area-inset-bottom));
  }
  .stage-row {
    width: calc(var(--preview-max) + var(--tab-width) + var(--tab-pop));
    max-width: none;
  }
  /* 머리줄과 선택 영역 뒤에 한 장의 흰 판을 깜 (따로 칠하면 둘 사이 그림자가 겹쳐 줄이 생기고,
     잘라서 막으면 머리줄 아래로 뜨는 '내 주문' 말풍선까지 잘림) */
  .app::before {
    content: "";
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-bottom: calc(-1 * env(safe-area-inset-bottom));
    background: var(--color-surface);
    box-shadow: -8px 0 32px rgba(31, 29, 26, .06);
  }
  .topbar { grid-column: 2; grid-row: 1; position: relative; z-index: 3; }
  .panel {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 0;
    box-shadow: none;
  }
}

/* 좌우 배치 중 세로 공간이 넉넉한 화면(폴드 펼침, 태블릿 가로, 노트북):
   선택지를 옆으로 밀어 보게 하지 않고 여러 줄로 줄바꿈해서 한눈에 다 보이게
   (폰 가로처럼 낮은 화면은 세로 공간이 빠듯해서 한 줄 가로 스크롤 유지) */
@media (min-width: 720px) and (min-aspect-ratio: 4/5) and (min-height: 601px) {
  /* 폭에 맞춰 칸 수를 정하고 남는 폭은 칸들이 고르게 나눠 가짐 (3개 + 1개처럼 들쭉날쭉하지 않게) */
  .choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--choice-grid-min), 1fr));
    gap: 10px 4px;
    overflow: visible;
    scroll-snap-type: none;
  }
  .choice { min-width: 0; max-width: none; }
  .choices-wrap::before,
  .choices-wrap::after { display: none; }   /* '옆에 더 있음' 흐림 표시는 필요 없음 */

  /* 세로가 넉넉하면(폴드 펼침·태블릿·노트북) 색 팔레트는 넘기지 않고 다 보이게:
     한 줄 = 한 계열 5단계 (9줄). 오른쪽 칸이 좁아도 칸이 크게 나옴 */
  .choices.is-palette {
    grid-template-columns: repeat(var(--palette-shades, 5), minmax(0, var(--palette-cell-max)));
    grid-auto-rows: auto;
    overflow: visible;
    scroll-snap-type: none;
  }
}


/* =========================================================
   효과 정의 (속도는 맨 위 --dur-* 변수로 조절)
   ========================================================= */
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes stack-in { from { opacity: 0; transform: scale(.97); } }
@keyframes stack-out { to { opacity: 0; transform: scale(.98); } }
@keyframes panel-in-down { from { opacity: 0; transform: translateY(var(--panel-shift)); } }
@keyframes panel-in-up { from { opacity: 0; transform: translateY(calc(var(--panel-shift) * -1)); } }
@keyframes tab-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
@keyframes bump-a { 40% { transform: scale(var(--price-bump-scale)); } }
@keyframes bump-b { 40% { transform: scale(var(--price-bump-scale)); } }
@keyframes pick-bump-a { 40% { transform: scale(var(--pick-bump-scale)); } }
@keyframes pick-bump-b { 40% { transform: scale(var(--pick-bump-scale)); } }
@keyframes fly-to-cart {
  70% { opacity: 1; }
  to { opacity: 0; transform: translate(var(--fly-x), var(--fly-y)) scale(var(--fly-scale)); }
}
@keyframes flash { 30% { opacity: .08; } }
@keyframes morph-to { to { transform: translate(var(--mx), var(--my)) scale(var(--ms)); } }
@keyframes view-sheet-in { from { transform: translateY(100%); } }
@keyframes view-sheet-out { to { transform: translateY(100%); } }
@keyframes view-tab-in { from { transform: translateX(calc(-1 * var(--tab-travel))); } }   /* 미리보기 몸통 뒤 깊은 곳(--tab-hide-depth)에서 */
@keyframes view-tab-out { to { transform: translateX(calc(-1 * var(--tab-travel))); } }    /* 같은 깊이까지 (다 숨은 뒤에는 탭 열을 숨김) */
@keyframes view-tab-wait { from, to { visibility: hidden; } }
@keyframes view-rise-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes view-drop-in { from { opacity: 0; transform: translateY(40px); } }
@keyframes view-drop-out { to { opacity: 0; transform: translateY(40px); } }
@keyframes hint-bob { 50% { translate: 0 4px; } }
@keyframes choices-hint { 35% { transform: translateX(-36px); } 55% { transform: translateX(-36px); } }
@keyframes intro-to-title { from { opacity: 1; transform: none; } to { opacity: 1; transform: translate(var(--to-x), var(--to-y)) scale(var(--to-scale)); } }

@keyframes label-a { from { opacity: 0; transform: translateY(6px); } }
@keyframes label-b { from { opacity: 0; transform: translateY(6px); } }
@keyframes count-a { 40% { transform: scale(var(--count-bump-scale)); } }
@keyframes count-b { 40% { transform: scale(var(--count-bump-scale)); } }
@keyframes nudge-a { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } 90% { transform: translateX(1px); } }
@keyframes nudge-b { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } 90% { transform: translateX(1px); } }
@keyframes skeleton-in { from { opacity: 0; } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 둘러보기: 가로로 넓은 화면(폰 가로, 폴드 펼침, 태블릿 가로, 노트북)에서는 그림 왼쪽, 이름·설명·버튼 오른쪽 */
@media (orientation: landscape) and (max-height: 600px), (min-width: 720px) and (min-aspect-ratio: 4/5) {
  :root { --slide-visual: min(calc(100svh - var(--topbar-height) - 56px), 46vw, 520px); }
  .slide { flex-direction: row; gap: clamp(24px, 5vw, 56px); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .slide-info { align-items: flex-start; max-width: 320px; text-align: left; }
}

/* 동작 줄이기: 등장 효과를 아예 끔
   (길이 0ms 애니메이션은 일부 브라우저에서 첫 프레임에 멈춰 보일 수 있어서 none 으로 끔) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .spinner { animation: spin 1.6s linear infinite !important; }   /* 전송 중 표시는 기능이라 유지 */
}


/* ───── 이용 안내 / 개인정보 처리방침 창 (아래에서 올라옴, 주문 창·주소 찾기 위) ───── */
.legal-layer {
  position: fixed;
  inset: 0;
  z-index: 16;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--color-surface);
  transform: translateY(100%);
  transition: transform var(--dur-sheet) var(--ease-out);
}
.legal-layer.is-open { transform: none; }
html.is-legal, html.is-legal body { background: var(--color-surface); }
.legal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: env(safe-area-inset-top) 6px 0 16px;
  border-bottom: 1px solid var(--color-line);
  box-sizing: content-box;
  touch-action: none;
}
.legal-title { margin: 0; font-size: var(--font-size-md); font-weight: 700; }
.legal-title:focus, .legal-title:focus-visible { outline: none; }
.legal-close { min-height: 44px; padding: 0 12px; font-weight: 600; color: var(--color-text-soft); }
.legal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  padding: 8px var(--gutter) calc(32px + env(safe-area-inset-bottom));
  font-size: var(--font-size-sm);
  line-height: 1.65;
  word-break: keep-all;
}
.legal-section h3 { margin: 18px 0 6px; font-size: var(--font-size-sm); font-weight: 700; }
.legal-section p { margin: 0 0 6px; color: var(--color-text-soft); }
/* 묶음: 들여쓴 '• 이름' + 그 아래 '- 항목' */
.legal-group { margin: 0 0 8px; padding-left: 12px; }
.legal-section .legal-group-label { position: relative; margin: 0 0 2px; }
.legal-group-label::before,
.legal-section.is-list > p::before { content: "•"; position: absolute; left: -12px; }
/* 섹션에 "list": true 면 글 한 줄마다 점 (결제·배송, 상품 정보) */
.legal-section.is-list > p { position: relative; margin-left: 12px; }
.legal-section > p:first-child { margin-top: 16px; }   /* 제목 없는 칸(처리방침)은 머리줄과 띄움 */
.legal-dash { margin: 0; padding: 0 0 0 14px; list-style: none; color: var(--color-text-soft); }
.legal-dash li { position: relative; margin: 0 0 2px; }
.legal-dash li::before { content: "-"; position: absolute; left: -12px; }
@media (prefers-reduced-motion: reduce) {
  .legal-layer { transition: none; }
}

/* 고지 문구의 가안 부분 (products.json에서 [[ ]]로 감싼 글) */
.is-draft { color: var(--color-draft); }
