/* 온글잎 박다현체 — 눈누(noonnu.cc/font_page/1541) 웹폰트 스니펫. 웹 사용 가능, 폰트 파일 재배포 금지 */
@font-face {
  font-family: 'OngleipParkDahyeon';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2411-3@1.0/Ownglyph_ParkDaHyun.woff2') format('woff2');
  font-weight: normal;
  font-display: swap;
}

/* 원칙: 면(종이·보드·버튼·칩·입력칸)은 민무늬 단색. 크레용 질감은 벽지와 캔버스 안의 오브제(빼빼로·오븐·재료·토핑)에만. */
:root {
  --ivory: #fffaf0;      /* 떠 있는 종이 */
  --board: #ffffff;      /* 작업 보드 */
  --soft: #f4eada;       /* 보조 버튼·칩 */
  --line: #ecdfc9;       /* 옅은 구분선 */
  --ink: #4a342a;        /* 글자 (따뜻한 갈색) */
  --muted: #94806f;      /* 보조 글자 */
  --terra: #d2573c;      /* 주 버튼 (테라코타) */
  --font: 'OngleipParkDahyeon', 'Gaegu', 'Apple SD Gothic Neo', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  padding: 0 0 1px;
  font-family: var(--font);
  color: var(--ink);
  background: #fbe3e6 url('../assets/tex/gingham-star.webp') repeat;
  background-size: 320px 320px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-size: 20px;
  line-height: 1.3;
}

/* 로고: 레이스 종이 바깥, 벽지 위에 크게. 글자에 두꺼운 아이보리 테두리를 둘러 체크무늬 위에서도 읽힌다 */
.logo { max-width: 400px; margin: 0 auto; padding: 10px 20px 0; }
.logo svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 4px 0 rgba(107, 63, 42, .2)); }
.logo text { font-family: var(--font); font-weight: 700; paint-order: stroke fill; stroke: var(--ivory); stroke-linejoin: round; stroke-linecap: round; }
.logo-sub { font-size: 44px; fill: var(--ink); stroke-width: 13px; }
.logo-main { font-size: 78px; fill: var(--terra); stroke-width: 18px; }
.logo-badge rect { fill: var(--ink); stroke: var(--ivory); stroke-width: 6px; }
.logo-badge text { font-size: 30px; fill: var(--ivory); stroke: none; }

/* 벽지 위에 올린 레이스 도일리 한 장. 물결 테두리는 ::before 에 border-image 로 그린다 (구멍으로 벽지가 비친다) */
#app {
  --lace: 30px;          /* 물결 한 칸 크기 */
  --lace-out: 18px;      /* 물결이 상자 밖으로 나가는 폭 */
  max-width: 470px;
  margin: 22px auto 44px;
  padding: 16px 18px 22px;
  position: relative;
  isolation: isolate;
}
#app::before {
  content: '';
  position: absolute; inset: calc(-1 * var(--lace-out)); z-index: -1;
  border: var(--lace) solid transparent;
  border-image: url('../assets/lace.svg') 120 round;
  /* 가운데는 한 장짜리 단색으로 깐다 (타일로 채우면 이음매 줄이 보인다). 물결 타일의 안쪽 15%와 겹치게 */
  background: linear-gradient(var(--ivory), var(--ivory)) center / calc(100% - var(--lace) * 1.7) calc(100% - var(--lace) * 1.7) no-repeat border-box;
  filter: drop-shadow(0 5px 0 rgba(107, 63, 42, .16));
  pointer-events: none;
}
@media (max-width: 520px) { #app { margin: 20px 22px 40px; padding: 14px 10px 18px; } }

.topbar { padding: 0 0 8px; }
/* 단계 표시: 짜기 › 굽기 › 코팅 › 토핑 › 포장 */
.steps { display: flex; align-items: center; justify-content: center; gap: 3px; list-style: none; margin: 0; padding: 0; font-size: 16px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.steps li + li::before { content: '›'; font-size: 20px; line-height: 1; color: #cdbba3; margin: 0 3px 0 1px; }
.steps li span { padding: 3px 10px; border-radius: 999px; }
.steps li.on span { background: var(--ink); color: var(--ivory); font-weight: 700; }
.steps li.done span { color: var(--terra); }
.steps li.done + li::before { color: var(--terra); }

.screen { display: none; animation: pop .22s ease-out; }
.screen.on { display: block; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

h1 { font-size: 34px; line-height: 1.15; margin: 14px 0 8px; }
h2 { font-size: 27px; margin: 6px 0 10px; text-align: center; }
.sub { color: var(--muted); margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 17px; margin: 0 0 12px; text-align: center; }
.hint.below { font-size: 15px; margin: 10px 0 0; }
.tiny { font-size: 14px; color: var(--muted); margin-top: 12px; }

.hero { text-align: center; padding-top: 6px; }
#heroCanvas { width: 100%; max-width: 340px; height: auto; display: block; margin: 0 auto; }

/* 버튼: 민무늬 + 필(pill) */
.btn {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  background: var(--soft);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: transform .08s, opacity .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--terra); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
.btn.big { font-size: 24px; padding: 15px 38px; }
.btn.small { font-size: 16px; padding: 8px 16px; }

.row { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 16px 0 4px; }
.row.small { margin-top: 8px; }

/* 보드(캔버스 영역): 민무늬. 캔버스는 투명이라 보드 색이 그대로 비친다 */
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--board);
  border-radius: 24px;
  overflow: hidden;
}
.board.tall { aspect-ratio: 4 / 4.2; }
.board.card { aspect-ratio: 3 / 4; }
.board.plain { background: transparent; }
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* 칩: 민무늬 필 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 6px 0 12px; }
.chip {
  font-family: var(--font); font-size: 17px; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; background: var(--soft); border: none; border-radius: 999px; cursor: pointer;
  transition: transform .08s;
}
.chip:active { transform: scale(.95); }
.chip i { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.chip.on { background: var(--ink); color: var(--ivory); }
.chip.sq { padding: 5px; border-radius: 16px; }
.chip.sq i { width: 32px; height: 32px; border-radius: 11px; }
.ic.straw { background: #c9482e; }
.ic.sprinkle { background: conic-gradient(#c9482e 0 25%, #8faac2 0 50%, #e2a93c 0 75%, #7e9a4e 0); }
.ic.almond { background: #d9a873; }
.ic.coconut { background: #fbf4de; box-shadow: inset 0 0 0 1.5px var(--line); }
.ic.heart { background: #efa6b0; }
.ic.cookie { background: #6b3f2a; }
.bx.b0 { background: repeating-linear-gradient(90deg, #c9482e 0 6px, #fbf4de 6px 12px); }
.bx.b1 { background: #8faac2; background-image: radial-gradient(#fbf4de 2.5px, transparent 3px); background-size: 10px 10px; }
.bx.b2 { background: repeating-linear-gradient(45deg, #5a6a34 0 5px, #fbf4de 5px 10px); }
.bx.b3 { background: #efa6b0; background-image: radial-gradient(#fbf4de 2px, transparent 2.5px); background-size: 8px 8px; }

.result { text-align: center; font-size: 22px; font-weight: 700; margin: 12px 0 0; }

/* 폼 */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin-top: 14px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-weight: 700; font-size: 16px; color: var(--muted); min-width: 0; }
.form label.full { grid-column: 1 / -1; }
.form input {
  width: 100%; min-width: 0;
  font-family: var(--font); font-size: 20px; color: var(--ink);
  background: var(--board); border: 2px solid var(--line); border-radius: 16px;
  padding: 9px 14px; outline: none;
}
.form input:focus { border-color: var(--terra); }

/* 카메라 */
.cam { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #2a211c; border-radius: 24px; overflow: hidden; }
.cam video, .cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam video { transform: scaleX(-1); }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 140px; font-weight: 700; color: #fff; text-shadow: 0 4px 0 rgba(74, 52, 42, .6); pointer-events: none; }
.handguide { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); font-size: 90px; opacity: .5; pointer-events: none; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -8px); } }

/* 공유 */
.sharebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.sharebtns .btn { width: 100%; padding-left: 12px; padding-right: 12px; }
.sharebtns .btn.primary { grid-column: 1 / -1; }
.url { width: 100%; margin-top: 8px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); background: transparent; border: 1px dashed var(--line); border-radius: 10px; padding: 6px 10px; }

.giftmsg { margin: 14px 0 0; text-align: center; font-size: 24px; line-height: 1.35; padding: 14px 18px; background: var(--soft); border-radius: 22px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--ivory); padding: 10px 20px; border-radius: 999px; font-size: 17px; z-index: 50; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
