@font-face { font-family: 'Gmarket Sans'; src: url(fonts/gmarket-bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Gmarket Sans'; src: url(fonts/gmarket-medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url(fonts/pretendard-medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url(fonts/pretendard-semibold.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url(fonts/pretendard-bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url(fonts/pretendard-extrabold.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #FFD43B; --fg: #151515; --soft: rgba(21, 21, 21, .66);
  --btn: #151515; --btnfg: #FFFFFF; --line: rgba(21, 21, 21, .22);
  --paper: #FCFBF7; --ink: #1D1C1A; --gray: #77736A;
  --G: 'Gmarket Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --P: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}
body[data-theme="cobalt"] { --bg: #2443F0; --fg: #FFFFFF; --soft: rgba(255, 255, 255, .78); --btn: #FFFFFF; --btnfg: #2443F0; --line: rgba(255, 255, 255, .32); }
body[data-theme="cherry"] { --bg: #D7261E; --fg: #FFFFFF; --soft: rgba(255, 255, 255, .8); --btn: #FFFFFF; --btnfg: #B51D16; --line: rgba(255, 255, 255, .34); }
body[data-theme="lilac"] { --bg: #C3B1FF; --fg: #151515; --soft: rgba(21, 21, 21, .68); --btn: #151515; --btnfg: #FFFFFF; --line: rgba(21, 21, 21, .22); }
body[data-theme="tree"] { --bg: #0E4733; --fg: #FFFFFF; --soft: rgba(255, 255, 255, .76); --btn: #FFFFFF; --btnfg: #0E4733; --line: rgba(255, 255, 255, .28); }
body[data-theme="forge"] { --bg: #171513; --fg: #FFFFFF; --soft: rgba(255, 255, 255, .72); --btn: #FF6A1A; --btnfg: #171513; --line: rgba(255, 255, 255, .22); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 500 16px/1.6 var(--P); letter-spacing: -0.01em;
  transition: background-color .45s ease, color .45s ease;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
.wrap { max-width: 520px; margin: 0 auto; padding: 0 22px calc(40px + env(safe-area-inset-bottom)); }

.bar { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 6px; font-size: 14px; }
.brand { font: 700 15px/1 var(--G); }
.ig { color: var(--soft); text-decoration: none; }
.ig:hover { text-decoration: underline; }

/* 첫 화면 */
.hero { padding-top: 26px; }
h1 {
  margin: 0; font: 700 clamp(56px, 17vw, 84px)/0.98 var(--G); letter-spacing: -0.045em;
}
.lede { margin: 16px 0 0; max-width: 23em; font-size: 17px; color: var(--soft); }

.printer { position: relative; margin: 34px auto 8px; width: min(100%, 330px); }
.slot {
  position: relative; z-index: 2; height: 22px; margin: 0 -18px; border-radius: 11px;
  background: #151515; box-shadow: inset 0 -5px 0 #000, 0 8px 18px rgba(0, 0, 0, .18);
}
body[data-theme="forge"] .slot { background: #2A2622; box-shadow: inset 0 -5px 0 #0B0A09, 0 0 0 1px rgba(255, 255, 255, .08); }
.feed { position: relative; z-index: 1; margin: -11px 6px 0; overflow: hidden; }
.feed canvas {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .2));
  transform: translateY(-101%);
}
.feed.go canvas { animation: print 2.6s steps(26, end) .35s forwards; }
@keyframes print { to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .feed canvas, .feed.go canvas { animation: none; transform: none; }
  body { transition: none; }
}

/* 단계 */
.steps { list-style: none; margin: 40px 0 0; padding: 0; }
.step { padding: 30px 0 32px; border-top: 2px dashed var(--line); }
.step h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font: 800 21px/1.3 var(--P); letter-spacing: -0.02em; }
.n {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid currentColor; font: 700 16px/1 var(--G); padding-top: 2px;
}
.step > p { margin: 0 0 16px; color: var(--soft); }
.step .tip { margin: 14px 0 0; font-size: 14px; color: var(--soft); }

/* 영수증 종이처럼 아래가 톱니로 잘린 칸 */
.paper {
  --z: 9px;
  position: relative; background: var(--paper); color: var(--ink);
  padding: 18px 18px calc(var(--z) + 16px);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--z) * 2) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--z) * 2) 100%;
}
.prompt pre {
  margin: 0; max-height: 196px; overflow: auto; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
  font: 500 13.5px/1.62 var(--P); color: #3B3934;
}
textarea {
  display: block; width: 100%; min-height: 210px; border: 0; outline: 0; resize: vertical; background: transparent;
  font: 500 15px/1.6 var(--P); color: var(--ink);
}
textarea::placeholder { color: #A39E92; }
.paper:focus-within { box-shadow: inset 0 0 0 3px var(--btn); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 22px;
  border: 0; border-radius: 14px; cursor: pointer; text-decoration: none;
  font: 700 17px/1 var(--P); letter-spacing: -0.01em;
}
.btn.primary { background: var(--btn); color: var(--btnfg); }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 2px var(--line); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .sw:focus-visible, .ig:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
#copy { width: 100%; margin-top: 14px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }

.open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--soft); }
.open span { margin-right: 4px; }
.chip {
  padding: 8px 13px; border-radius: 999px; text-decoration: none; font: 700 14px/1 var(--P); color: var(--fg);
  box-shadow: inset 0 0 0 2px var(--line);
}
.chip:hover { box-shadow: inset 0 0 0 2px var(--fg); }

.err { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--fg); color: var(--bg); font-weight: 600; font-size: 15px; }

/* 색 고르기 */
.themes { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 4px 0 18px; }
.sw {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 600 13px/1 var(--P); color: var(--soft);
}
.sw i {
  display: block; width: 44px; height: 44px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .14), 0 0 0 0 var(--fg); transition: box-shadow .2s;
}
.sw[aria-checked="true"] { color: var(--fg); }
.sw[aria-checked="true"] i { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .14), 0 0 0 3px var(--bg), 0 0 0 6px var(--fg); }

.result {
  position: relative; display: grid; place-items: center; min-height: 220px; border-radius: 22px; overflow: hidden;
  box-shadow: 0 0 0 2px var(--line);
}
.result img { display: block; width: 100%; height: auto; -webkit-touch-callout: default; user-select: auto; }
.empty { margin: 0; padding: 30px; text-align: center; color: var(--soft); font-size: 15px; }
.result.has { box-shadow: 0 24px 50px rgba(0, 0, 0, .25), 0 0 0 2px var(--line); }

.foot { margin-top: 10px; padding-top: 24px; border-top: 2px dashed var(--line); font-size: 13.5px; color: var(--soft); }
.foot p { margin: 0 0 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 9;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 13px 18px; border-radius: 12px; background: #151515; color: #fff; font: 700 15px/1.2 var(--P);
  transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .wrap { max-width: 1040px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 72px; }
  .bar { grid-column: 1 / -1; }
  .hero { position: sticky; top: 0; align-self: start; padding-bottom: 40px; }
  .steps { margin-top: 26px; }
  .step:first-child { border-top: 0; padding-top: 10px; }
  .foot { grid-column: 2; }
}
