/* ============================================================
   dangol.css — 모두의 단골 공용 스타일 (손님 + 사장 화면)
   어휘: 동네가게 단골 도장 — 인주(도장밥) 빨강, 먹 네이비, 한지 화이트.
   시그니처: 절취선으로 나뉜 "반반 티켓"(나/친구) + 추천 도장판.
   손님 화면 액센트(--brand)는 사장 설정 컬러로 런타임 치환된다.
============================================================ */

:root {
  --paper: #fcfaf5;        /* 한지 화이트 */
  --card: #ffffff;
  --ink: #22304a;          /* 먹 네이비 */
  --muted: #7d8698;
  --line: #e7e1d4;
  --brand: #d9432c;        /* 인주 버밀리언 (기본값, cfg.c로 치환) */
  --jade: #2e9e83;         /* 사용완료/성공 */
  --shadow: 0 10px 30px rgba(34, 48, 74, .10);
  --radius: 16px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          system-ui, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* amazingframe에서 배운 특이도 충돌 방지 */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  letter-spacing: -.01em;
  line-height: 1.5;
  word-break: keep-all;      /* 한글 어절 단위 개행 — 단어가 두 동강 나지 않게 */
  overflow-wrap: break-word; /* 긴 URL·토큰 오버플로 안전장치 */
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ── 레이아웃 뼈대 ─────────────────────────────── */
.wrap { width: min(560px, 100% - 32px); margin: 0 auto; }
.wrap--wide { width: min(1080px, 100% - 40px); margin: 0 auto; }

.app-head { padding: 28px 0 10px; }
.app-head .service-mark {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 800; letter-spacing: .14em;
  color: var(--brand); text-transform: uppercase;
}
.app-head .service-mark .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid var(--brand);
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 8px var(--brand);
}
.app-head h1 {
  margin: 10px 0 4px;
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 800; letter-spacing: -.04em; line-height: 1.15;
}
.app-head .sub { margin: 0; color: var(--muted); font-size: 15px; }

.demo-pill {
  display: inline-block; margin-top: 10px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(34, 48, 74, .07); color: var(--ink);
  font-size: 12.5px; font-weight: 700;
}
.demo-pill a { color: var(--brand); font-weight: 800; }

section { margin: 26px 0; }
.sec-title {
  margin: 0 0 4px; font-size: 18px; font-weight: 800; letter-spacing: -.02em;
}
.sec-hint { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }

/* ── 버튼 ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px;
  padding: 15px 22px;
  font-size: 16px; font-weight: 800; letter-spacing: -.01em;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent);
}
.btn--ghost {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn--block { width: 100%; }
.btn--sm { padding: 10px 14px; font-size: 14px; border-radius: 10px; }

/* ── 초대 도착 시트 (추천 링크로 진입 시) ───────── */
.invite-hero {
  position: relative;
  background: var(--card);
  border: 1.5px solid color-mix(in srgb, var(--brand) 45%, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 20px;
  overflow: hidden;
}
.invite-hero .from {
  font-size: 13px; font-weight: 800; color: var(--brand); letter-spacing: .02em;
}
.invite-hero h2 { margin: 8px 0 6px; font-size: 21px; font-weight: 800; letter-spacing: -.03em; }
.invite-hero p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.invite-hero::after {   /* 봉투에서 삐져나온 티켓 모서리 */
  content: ""; position: absolute; right: -22px; top: -22px;
  width: 84px; height: 84px; border-radius: 18px;
  background: color-mix(in srgb, var(--brand) 12%, var(--paper));
  transform: rotate(18deg);
}

/* ── 추천 도장판 ──────────────────────────────── */
.board {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.board-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.slot { text-align: center; }
.slot .ring {
  position: relative; width: 74px; height: 74px; margin: 0 auto 8px;
  border: 2.5px dashed color-mix(in srgb, var(--ink) 26%, transparent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; font-weight: 700;
}
.slot .reward { font-size: 12px; color: var(--muted); line-height: 1.35; word-break: keep-all; }
.slot.is-stamped .ring { border-style: solid; border-color: transparent; }
.slot.is-stamped .reward { color: var(--ink); font-weight: 700; }

/* 인주 도장 마크 — 도장판·티켓·사용완료 공용 */
.stamp-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 66px; height: 66px; border-radius: 50%;
  border: 3px solid var(--brand);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 55%, transparent);
  color: var(--brand);
  font-size: 17px; font-weight: 900; letter-spacing: .06em;
  transform: rotate(-12deg);
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%);
}
.stamp-mark--in { animation: stampIn .45s cubic-bezier(.2, 1.6, .4, 1) both; }

.board-progress { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.board-progress strong { color: var(--brand); }

/* ── 추천 보내기 ──────────────────────────────── */
.share-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.field { margin: 0 0 12px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field .opt { color: var(--muted); font-weight: 500; }
.field input[type="text"], .field select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; }
.share-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

/* ── 쿠폰 지갑: 반반 티켓 ─────────────────────── */
.wallet-empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 26px 20px; text-align: center; color: var(--muted); font-size: 14px;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.ticket-list { display: flex; flex-direction: column; gap: 14px; }

.ticket {
  position: relative;
  display: grid; grid-template-columns: 1fr 92px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ticket--in { animation: ticketUp .4s ease both; }
.ticket .main { padding: 16px 14px 14px 18px; min-width: 0; }
.ticket .kind {
  font-size: 11px; font-weight: 800; letter-spacing: .1em;
  color: var(--brand); text-transform: uppercase;
}
.ticket .label {
  margin: 6px 0 8px; font-size: 16.5px; font-weight: 800;
  letter-spacing: -.02em; line-height: 1.3; word-break: keep-all;
}
.ticket .meta { font-size: 12px; color: var(--muted); }
.ticket .meta .serial { font-variant-numeric: tabular-nums; font-weight: 700; }
.ticket .actions { margin-top: 12px; }

/* 절취선 + 펀치홀 + 친구 반쪽 */
.ticket .stub {
  position: relative;
  border-left: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent);
  background: color-mix(in srgb, var(--brand) 7%, var(--card));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 6px;
  text-align: center;
}
.ticket .stub::before, .ticket .stub::after {
  content: ""; position: absolute; left: -9px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--line);
}
.ticket .stub::before { top: -9px; }
.ticket .stub::after { bottom: -9px; }
.ticket .stub .who { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--brand); }
.ticket .stub .together { font-size: 11.5px; color: var(--muted); line-height: 1.3; word-break: keep-all; }

/* 상태 변형 */
.ticket.is-used, .ticket.is-expired { opacity: .62; }
.ticket.is-used .label, .ticket.is-expired .label { text-decoration: line-through; text-decoration-thickness: 2px; }
.ticket .state-stamp {
  position: absolute; right: 96px; top: 50%;
  transform: translateY(-50%) rotate(-14deg);
  border: 2.5px solid var(--jade); color: var(--jade);
  border-radius: 8px; padding: 3px 8px;
  font-size: 13px; font-weight: 900; letter-spacing: .12em;
  background: rgba(255, 255, 255, .82);
}
.ticket.is-expired .state-stamp { border-color: var(--muted); color: var(--muted); }

/* ── 직원 확인 오버레이 ───────────────────────── */
.verify {
  position: fixed; inset: 0; z-index: 60;
  background: var(--brand);
  color: #fff;
  display: flex; flex-direction: column;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  overflow: auto;
}
.verify .top { display: flex; justify-content: space-between; align-items: center; }
.verify .store { font-size: 15px; font-weight: 800; letter-spacing: -.01em; opacity: .95; }
.verify .close {
  background: rgba(255, 255, 255, .16); color: #fff; border: 0;
  border-radius: 999px; width: 40px; height: 40px; font-size: 18px; font-weight: 800;
}
.verify .body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 6px;
  padding: 26px 0;
}
.verify .cap { font-size: 13px; font-weight: 800; letter-spacing: .16em; opacity: .85; }
.verify .reward {
  margin: 6px 0; font-size: clamp(26px, 7.5vw, 34px);
  font-weight: 900; letter-spacing: -.03em; line-height: 1.25; word-break: keep-all;
  max-width: 22ch;
}
.verify .clock {
  margin-top: 8px;
  font-size: clamp(30px, 9vw, 42px); font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.verify .clock .tick { animation: blink 1s steps(1) infinite; }
.verify .dates { font-size: 13px; opacity: .85; margin-top: 4px; }
.verify .serial {
  margin-top: 14px; font-size: 14px; font-weight: 800;
  border: 1.5px dashed rgba(255, 255, 255, .55);
  border-radius: 10px; padding: 7px 14px; letter-spacing: .1em;
}
.verify .staff-note { font-size: 13.5px; opacity: .9; margin: 0 0 12px; }
.verify .btn--staff {
  background: #fff; color: var(--brand);
  width: 100%; font-size: 17px;
}
.verify .btn--staff.is-arming { background: rgba(255, 255, 255, .92); }
.verify .used-mark {
  align-self: center;
  border: 3px solid #fff; color: #fff; border-radius: 12px;
  padding: 10px 22px; font-size: 22px; font-weight: 900; letter-spacing: .2em;
  transform: rotate(-8deg);
}

/* ── 발급 연출 오버레이 (도장 쿵) ─────────────── */
.issued {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(34, 48, 74, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.issued .panel {
  width: min(420px, 100%);
  background: var(--paper); border-radius: 18px;
  padding: 26px 22px; text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .3);
}
.issued .stamp-mark { width: 86px; height: 86px; font-size: 21px; margin-bottom: 12px; }
.issued h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.issued p { margin: 0 0 18px; color: var(--muted); font-size: 14px; word-break: keep-all; }

/* ── 토스트 ───────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 80;
  background: var(--ink); color: #fff;
  border-radius: 12px; padding: 12px 18px;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  max-width: min(420px, calc(100vw - 40px));
  text-align: center;
}

/* ── 푸터 ─────────────────────────────────────── */
.app-foot {
  margin: 40px 0 28px; text-align: center;
  color: var(--muted); font-size: 12px;
}
.app-foot a { color: var(--muted); }

/* ════════════════════════════════════════════════
   사장 설정 화면 (owner.html)
════════════════════════════════════════════════ */
.owner-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 8px; }
@media (min-width: 880px) {
  .owner-grid { grid-template-columns: 1.05fr .95fr; align-items: start; }
  .owner-preview { position: sticky; top: 20px; }
}

.panel {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px;
}
.panel h2 { margin: 0 0 4px; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.panel .desc { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid transparent; padding: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7);
}
.swatch.is-active { border-color: var(--ink); }
.swatch-custom { width: 46px; height: 38px; border: 1.5px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }

.tier-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; color: var(--brand); letter-spacing: .06em;
}

/* 결과(링크·QR) */
.result-box { margin-top: 18px; }
.qr-frame {
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px; width: fit-content; margin: 0 auto 14px;
}
.qr-frame svg { display: block; width: 200px; height: 200px; }
.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1; min-width: 0; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 12.5px; color: var(--muted); background: var(--paper);
}
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* 미리보기 패널 안 티켓/도장판 축소 재사용 */
.owner-preview .board-grid { margin-top: 10px; }
.owner-preview .slot .ring, .owner-preview .stamp-mark { width: 58px; height: 58px; font-size: 14px; }

/* ════════════════════════════════════════════════
   A4 포스터 인쇄 (owner.html → window.print)
════════════════════════════════════════════════ */
.print-poster { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body * { visibility: hidden; }
  .print-poster, .print-poster * { visibility: visible; }
  .print-poster {
    display: block;
    position: absolute; inset: 0;
    background: #fff; color: #22304a;
    font-family: var(--font);
    text-align: center;
    padding-top: 10mm;
  }
  .print-poster .p-mark {
    font-size: 13pt; font-weight: 800; letter-spacing: .2em;
    color: var(--brand);
  }
  .print-poster h1 {
    margin: 6mm 0 3mm; font-size: 30pt; font-weight: 900; letter-spacing: -.02em;
  }
  .print-poster .p-store { font-size: 15pt; font-weight: 700; margin-bottom: 8mm; }
  .print-poster .p-qr svg { width: 88mm; height: 88mm; }
  .print-poster ol {
    list-style: none; padding: 0; margin: 8mm auto 0; width: 130mm;
    text-align: left; font-size: 12.5pt; line-height: 1.65;
  }
  .print-poster ol li { margin-bottom: 3mm; padding-left: 11mm; position: relative; }
  .print-poster ol li::before {
    content: attr(data-step);
    position: absolute; left: 0; top: 0;
    width: 8mm; height: 8mm; border-radius: 50%;
    border: 1.2mm solid var(--brand); color: var(--brand);
    font-weight: 900; font-size: 11pt;
    display: inline-flex; align-items: center; justify-content: center;
    transform: rotate(-8deg);
  }
  .print-poster .p-foot { margin-top: 8mm; font-size: 10pt; color: #7d8698; }
}

/* ── 모션 ─────────────────────────────────────── */
@keyframes stampIn {
  0% { transform: rotate(-12deg) scale(2.1); opacity: 0; }
  60% { transform: rotate(-12deg) scale(.94); opacity: 1; }
  100% { transform: rotate(-12deg) scale(1); opacity: 1; }
}
@keyframes ticketUp {
  from { transform: translateY(22px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes blink { 50% { opacity: .25; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
