@font-face {
  font-family: "DSEG7";
  src: url("https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --kraft: #E4D0AE;
  --rule: rgba(43, 33, 24, 0.22);
  --ink: #2B2118;
  --ink-mute: #66533F;
  --film: #1C1814;
  --edge: #EADCC2;
  --stamp: #B5361F;     /* 브랜드 색 하나: 인주 빨강 */
  --out: cubic-bezier(0.16, 1, 0.3, 1);
  --head: "Black Han Sans", "Pretendard Variable", sans-serif;
  --cond: "Barlow Condensed", "Pretendard Variable", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--kraft); color: var(--ink); font-family: "Pretendard Variable", Pretendard, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#app { max-width: 460px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* 종이 결 */
.paper { position: relative; min-height: 100dvh; padding: max(14px, env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom)); isolation: isolate; }
.paper::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .42  0 0 0 0 .27  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.center { display: grid; place-items: center; align-content: center; gap: 18px; }
.busy { text-align: center; color: var(--ink-mute); font-weight: 600; margin: 40px 0; }

/* 봉투 머리와 양식 줄 */
.env-brand { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2.5px solid var(--ink); padding: 12px 0 10px; }
.env-brand b { font-family: var(--head); font-size: 30px; font-weight: 400; }
.env-brand i { font-style: normal; font-family: var(--cond); font-weight: 600; font-size: 14px; letter-spacing: .14em; color: var(--ink-mute); }
.form { margin-top: 16px; display: grid; grid-template-columns: 74px 1fr; border-top: 1px solid var(--rule); }
.form > div { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 15px; min-width: 0; }
.form .k { color: var(--ink-mute); font-weight: 600; font-size: 13px; padding-top: 15px; }
.form .v { font-weight: 700; }
.form input { width: 100%; border: 0; background: transparent; font-weight: 700; font-size: 17px; padding: 2px 0; outline: none; }
.form input::placeholder { color: rgba(102, 83, 63, .5); }
.form > div:has(input:focus) { border-bottom-color: var(--ink); }
.strong { font-weight: 700; }
.count { display: flex; gap: 6px; }
.count span { width: 26px; height: 26px; border: 1.5px solid var(--ink); border-radius: 4px; display: grid; place-items: center; font-family: var(--cond); font-weight: 700; font-size: 15px; opacity: .45; }
.count span.on { background: var(--stamp); border-color: var(--stamp); color: #fff; opacity: 1; }
.members { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.members em { font-style: normal; font-weight: 650; }
.members em.me::after { content: " (나)"; color: var(--ink-mute); font-weight: 500; }
.err { color: var(--stamp); font-weight: 650; font-size: 14px; min-height: 20px; margin: 12px 0 0; }
.page > .btn { width: 100%; margin-top: 10px; }

/* 버튼 */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 16px; border-radius: 14px; font-size: 16px; font-weight: 700; border: 0; text-decoration: none; color: var(--ink); transition: transform .15s var(--out); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.solid { background: var(--stamp); color: #fff; }
.btn.line { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
.link { background: none; border: 0; padding: 10px 4px; font-weight: 650; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link.mute { color: var(--ink-mute); }
.btn:focus-visible, .link:focus-visible, .btn-stamp:focus-visible, .mini:focus-visible, .icon-btn:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }

/* 찍자 도장 */
.go { display: grid; justify-items: center; margin-top: 36px; }
.btn-stamp { display: grid; place-items: center; width: 168px; height: 168px; border-radius: 50%; border: 0; background: var(--stamp); color: #fff;
  font-family: var(--head); font-size: 52px; transform: rotate(-7deg); transition: transform .2s var(--out);
  box-shadow: 0 14px 28px -10px rgba(181, 54, 31, .5), inset 0 0 0 7px var(--stamp), inset 0 0 0 10px rgba(255, 255, 255, .85); }
.btn-stamp span { transform: translateY(2px); }
.btn-stamp:active { transform: rotate(-7deg) scale(.94); }
.btn-stamp.done { font-size: 38px; }
.status-line { margin: 18px 0 0; font-size: 14px; font-weight: 650; color: var(--ink); }
.status-line b { font-family: var(--cond); font-size: 17px; color: var(--stamp); }
.tools { display: flex; justify-content: center; gap: 14px; margin-top: 22px; }

/* 지난 사진 */
.past { margin-top: 26px; }
.past h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.past-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.mini { flex: none; display: grid; gap: 6px; justify-items: start; background: none; border: 0; padding: 0; }
.mini:nth-child(2n) img { transform: rotate(1.5deg); }
.mini img { height: 150px; width: auto; border-radius: 3px; transform: rotate(-2deg); box-shadow: 0 8px 14px -8px rgba(0, 0, 0, .5); }
.mini small { font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: .06em; color: var(--ink-mute); }

/* 내 그룹 */
.mine { margin-top: 40px; }
.mine h3 { font-size: 14px; margin: 0 0 6px; }
.mine ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.mine a { display: block; padding: 14px 0; border-bottom: 1px solid var(--rule); color: var(--ink); font-weight: 700; text-decoration: none; }

/* 카메라 */
[data-screen="camera"] { background: #000; }
.cam { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam video.mirror { transform: scaleX(-1); }
.cam::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 22%, transparent 70%, rgba(0,0,0,.7)); }
.cam.flash::before { content: ""; position: absolute; inset: 0; z-index: 5; background: #fff; animation: flash .5s var(--out) forwards; }
@keyframes flash { to { opacity: 0; } }
.cam-top { position: absolute; z-index: 2; top: max(18px, env(safe-area-inset-top)); left: 20px; right: 20px; display: flex; justify-content: space-between; align-items: center; }
.who { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; }
.who b { background: var(--stamp); padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.ready { font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: .06em; }
.num { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; font-family: var(--cond); font-weight: 700; font-size: 240px; line-height: 1; text-shadow: 0 8px 40px rgba(0,0,0,.35); pointer-events: none; opacity: 0; }
.num.on { opacity: 1; animation: tick 1s var(--out) infinite; }
@keyframes tick { from { transform: scale(1.18); } to { transform: scale(1); } }
.cam-bot { position: absolute; z-index: 2; bottom: calc(36px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; }
.shutter { width: 84px; height: 84px; border-radius: 50%; border: 5px solid #fff; background: none; display: grid; place-items: center; padding: 0; }
.shutter i { width: 66px; height: 66px; border-radius: 50%; background: #fff; transition: transform .15s var(--out); }
.shutter:active i { transform: scale(.88); }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.round svg { width: 24px; height: 24px; }
.cam.nocam .shutter { visibility: hidden; }
.fallback { position: absolute; z-index: 3; left: 24px; right: 24px; top: 50%; transform: translateY(-50%); }

/* 판 화면 */
.round-view { display: flex; flex-direction: column; }
.res-head { display: flex; justify-content: space-between; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(43,33,24,.08); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.dev-head h2, .res-title h2 { margin: 0; font-family: var(--head); font-weight: 400; font-size: 32px; line-height: 1.2; }
.dev-head p, .res-title p { margin: 6px 0 0; font-size: 14px; color: var(--ink-mute); font-weight: 550; }
.dev-head p { font-family: var(--cond); font-size: 18px; font-weight: 600; letter-spacing: .04em; }
.late { display: inline-flex; gap: 6px; align-items: baseline; margin-top: 12px; padding: 7px 12px; border: 1.5px solid var(--stamp); color: var(--stamp); border-radius: 8px; font-weight: 700; font-size: 14px; }
.late b { font-family: var(--cond); font-size: 20px; }
.strip-hold { flex: 1; display: grid; place-items: center; padding: 22px 0; min-height: 300px; }
.strip { display: block; max-width: 72%; max-height: 56dvh; width: auto; border-radius: 3px; box-shadow: 0 22px 40px -18px rgba(0,0,0,.55); }
.strip.wide { max-width: 92%; }
.strip.tilt { transform: rotate(-1.8deg); }
.res-act { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-act .wide { grid-column: 1 / -1; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--edge); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 650; max-width: calc(100% - 32px); animation: up .3s var(--out); }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
.foot { margin-top: 48px; font-size: 13px; } .foot a { color: var(--ink-mute); }
.cam.nocam .cam-bot .round:last-child { visibility: hidden; }
