/* QR 꾸미기 공방 · 2026-09-19 전면 개편
   재미 앱 표준(헌법 §7): 크림 바탕 + 옅은 사선 줄무늬 · 흰 카드 · 검정 테두리 3px · 오프셋 그림자 · 제목만 Black Han Sans */

:root {
  --cream: #FFF6E5;
  --cream-2: #FCEFD5;
  --ink: #1B1B1F;
  --ink-2: #3A3530;
  --mute: #6E6456;
  --paper: #FFFFFF;
  --red: #E8332A;
  --yellow: #FFD13F;
  --navy: #2E4374;
  --green: #1F8A4C;
  --line: #1B1B1F;
  --title: 'Black Han Sans', 'Malgun Gothic', sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); line-height: 1.6; word-break: keep-all;
  background-color: var(--cream);
  background-image: repeating-linear-gradient(135deg, transparent 0 22px, rgba(233, 196, 128, .16) 22px 44px);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ── 머리 ───────────────────────────────── */
.shin-header { display: block; padding: 9px 0; }
.shin-header-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: #fff; font-weight: 800; font-size: 17px; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--red); }
.brand-name { font-weight: 800; font-size: .95rem; letter-spacing: -.01em; }
.head-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.tool-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink); font-size: 16px; line-height: 1; text-decoration: none; color: var(--ink); transition: transform .12s, box-shadow .12s; }
.tool-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.tool-btn[aria-pressed="false"] { opacity: .55; }

/* ── 틀 ─────────────────────────────────── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 4px 16px 40px; }
.card { background: var(--paper); border: 3px solid var(--line); border-radius: 18px; box-shadow: 5px 5px 0 var(--line); padding: 20px 18px; margin: 22px 0; }
.label { margin: 0 0 6px; font-size: .78rem; font-weight: 800; letter-spacing: .06em; color: var(--mute); }
.section-title { font-family: var(--title); font-weight: 400; font-size: 1.4rem; margin: 0 0 14px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; font-size: 1.05rem; border: 2px solid var(--ink); flex: none; }
.hint { margin: 6px 0 0; font-size: .82rem; color: var(--mute); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 16px; border-radius: 14px; border: 3px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 800; font-size: .98rem; text-decoration: none; box-shadow: 4px 4px 0 var(--line); transition: transform .12s, box-shadow .12s; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: 4px 4px 0 var(--line); }
.btn.primary { background: var(--yellow); }
.btn.red { background: var(--red); color: #fff; }

/* ── 첫 화면 ─────────────────────────────── */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-top: 8px; max-width: 900px; }
.kicker { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border: 2px solid var(--ink); border-radius: 99px; background: var(--yellow); font-size: .76rem; font-weight: 800; }
.logo { font-family: var(--title); font-weight: 400; margin: 0; line-height: 1.02; font-size: clamp(2.4rem, 10.5vw, 4.2rem); letter-spacing: -.02em; text-shadow: 3px 3px 0 var(--yellow); }
.logo .red { color: var(--red); }
.tagline { margin: 10px 0 0; font-size: 1.02rem; color: var(--ink-2); }
.tagline b { color: var(--ink); background: linear-gradient(transparent 58%, rgba(255, 209, 63, .75) 58%); }
.safe { display: inline-block; margin: 12px 0 0; padding: 6px 12px; border-radius: 10px; background: rgba(128, 128, 128, .12); font-size: .82rem; color: var(--ink-2); }
.hero-jo { position: relative; margin: 0; width: clamp(140px, 30vw, 250px); }
.hero-jo img { display: block; width: 100%; height: auto; }
/* 흰 판 안쪽 빈자리(assets/jo-board.webp 에서 잰 값 · 법률 §3-C) */
.hero-qr { position: absolute; left: 27.18%; top: 45.26%; width: 46.6%; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.bubble { position: absolute; right: 86%; top: 22%; width: max-content; max-width: 170px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; padding: 7px 10px; font-size: .8rem; font-weight: 700; line-height: 1.4; box-shadow: 3px 3px 0 var(--ink); }
.bubble::after { content: ''; position: absolute; right: -11px; top: 16px; width: 14px; height: 14px; background: var(--paper); border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(-45deg); }
@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr; position: relative; }
  .hero-jo { position: absolute; right: 0; top: 58px; width: 122px; z-index: 0; }
  .hero-copy { position: relative; z-index: 1; padding-right: 112px; }
  .bubble { display: none; }
  .tagline { font-size: .95rem; }
}
@media (max-width: 380px) { .hero-jo { width: 104px; } .hero-copy { padding-right: 94px; } }

/* ── 빠른 시작 ───────────────────────────── */
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.preset-grid button { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: #FFFCF4; box-shadow: 3px 3px 0 var(--ink); min-height: 64px; }
.preset-grid button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.preset-grid .pi { grid-row: 1 / 3; font-size: 1.6rem; line-height: 1; }
.preset-grid b { font-size: .92rem; line-height: 1.3; }
.preset-grid small { font-size: .74rem; color: var(--mute); font-weight: 700; }
.preset-grid button.on { background: var(--yellow); }
@media (min-width: 720px) { .preset-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── 작업대 ───────────────────────────────── */
.studio { display: grid; grid-template-columns: 1fr; gap: 0 22px; }
@media (min-width: 900px) {
  .studio { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .preview-col { position: sticky; top: 10px; }
}
.types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.types button, .chips button, .chips .upload {
  border: 2px solid var(--ink); border-radius: 99px; background: var(--paper); padding: 6px 12px; min-height: 38px;
  font-size: .88rem; font-weight: 800; box-shadow: 2px 2px 0 var(--ink); display: inline-flex; align-items: center; gap: 4px;
}
.types button[aria-selected="true"], .chips button[aria-checked="true"], .chips button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: 2px 2px 0 var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.emoji button { font-size: 1.05rem; padding: 4px 10px; }
.chips.emoji button:first-child { font-size: .86rem; }
.chips .upload { cursor: pointer; position: relative; overflow: hidden; }
.chips .upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chips .upload.on { background: var(--ink); color: #fff; }
.group-label { margin: 16px 0 8px; font-size: .82rem; font-weight: 900; color: var(--navy); letter-spacing: .02em; }
.form { display: grid; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .lab { font-size: .84rem; font-weight: 800; }
.field .lab em { font-style: normal; font-weight: 600; color: var(--mute); }
.field input, .field select, .field textarea {
  width: 100%; font-size: 16px; padding: 10px 12px; border: 2.5px solid var(--ink); border-radius: 12px; background: #FFFDF8; min-height: 46px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: end; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
.check-line { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 700; min-height: 40px; }
.check-line input { width: 20px; height: 20px; accent-color: var(--red); }
.frame-text { display: grid; gap: 10px; margin-top: 12px; }
.frame-text:empty { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 44px; height: 44px; border-radius: 12px; border: 2.5px solid var(--ink); padding: 0; position: relative; box-shadow: 2px 2px 0 var(--ink); overflow: hidden; }
.swatches button i { position: absolute; inset: 9px; border-radius: 50%; }
.swatches button[aria-checked="true"] { outline: 3px solid var(--red); outline-offset: 2px; }
.swatches button.custom { font-size: 1.1rem; background: conic-gradient(#E8332A, #FFD13F, #2E8B57, #2E4374, #8E44AD, #E8332A); }
.swatches button.custom span { position: relative; background: #fff; border-radius: 6px; padding: 0 4px; font-size: .72rem; font-weight: 900; }
.custom-color { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; padding: 10px 12px; border: 2px dashed var(--ink); border-radius: 12px; font-size: .86rem; font-weight: 700; }
.custom-color input[type="color"] { width: 44px; height: 32px; border: 2px solid var(--ink); border-radius: 8px; padding: 0; vertical-align: middle; background: none; }
.shapes { align-items: start; }

/* ── 미리보기 · 검사 ─────────────────────── */
.canvas-wrap { border-radius: 14px; padding: 14px; display: grid; place-items: center; background-color: #EDE7DC;
  background-image: linear-gradient(45deg, rgba(255,255,255,.55) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.55) 75%), linear-gradient(45deg, rgba(255,255,255,.55) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.55) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.canvas-wrap canvas { display: block; max-width: 100%; max-height: 520px; width: auto; height: auto; }
.err { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: #FFE3DF; color: #9A1B14; font-weight: 800; font-size: .88rem; }
.check { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; margin: 14px 0 12px; padding: 10px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: #FFFCF4; }
.check img { width: 96px; height: auto; display: block; }
.check-msg { margin: 6px 0 0; font-size: .92rem; font-weight: 700; }
.check-sub { margin: 4px 0 0; font-size: .8rem; color: var(--mute); }
.check-sub:empty { display: none; }
.stamp { display: inline-block; padding: 3px 10px; border: 3px solid currentColor; border-radius: 8px; font-family: var(--title); font-size: 1.15rem; letter-spacing: .04em; transform: rotate(-4deg); background: #fff; }
.stamp.ok { color: var(--green); }
.stamp.warn { color: #C77700; }
.stamp.ng { color: var(--red); }
.stamp.wait { color: var(--mute); }
.stamp.pop { animation: stampIn .35s cubic-bezier(.3, 1.6, .4, 1) both; }
@keyframes stampIn { from { transform: rotate(-4deg) scale(2); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }
.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dl-row #shareBtn { grid-column: 1 / -1; }
.print-tip { margin-top: 10px; }
.cta { display: grid; gap: 12px; background: #FFF1B8; }
.cta p { margin: 0; font-size: .93rem; }
.cta .btn { justify-self: start; }

.fine { margin: 26px 0 0; font-size: .8rem; color: var(--mute); line-height: 1.7; max-width: 820px; }
.fine p { margin: 0 0 6px; }
.foot { border-top: 3px solid var(--ink); background: var(--ink); color: #EDE6D8; padding: 20px 16px 28px; text-align: center; font-size: .82rem; }
.foot nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.foot a { color: #fff; text-decoration: none; font-weight: 700; }
.foot p { margin: 0; opacity: .8; }

/* 폰: 미리보기가 화면 밖이면 오른쪽 아래에 작은 미리보기 */
.mini-pv { position: fixed; right: 12px; bottom: 16px; z-index: 30; display: grid; justify-items: center; gap: 2px; padding: 6px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.mini-pv canvas { width: 64px; height: 64px; display: block; image-rendering: pixelated; }
.mini-pv span { font-size: .68rem; font-weight: 900; }
@media (min-width: 900px) { .mini-pv { display: none !important; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px); z-index: 50; max-width: min(88vw, 420px); padding: 10px 18px; border-radius: 12px; border: 2.5px solid var(--ink); background: var(--yellow); color: var(--ink); font-weight: 800; font-size: .9rem; text-align: center; box-shadow: 3px 3px 0 var(--ink); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 640px) { .card { padding: 22px 24px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
