/* 11/12 디자인 다시: 라온이 시안 6번 "연구실 아카이브" (남색 + 한지 + 작은 주홍 낙관), 보스 선택 */
@font-face { font-family: 'P'; src: url(../fonts/Pretendard-Bold.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'P'; src: url(../fonts/Pretendard-ExtraBold.woff2) format('woff2'); font-weight: 800 900; font-display: swap; }
/* 제목용 명조: Noto Serif KR(오픈 폰트 라이선스) Bold, 앱 글자 + 자주 쓰는 한글 2350자만 남김 */
@font-face { font-family: 'S'; src: url(../fonts/NotoSerifKR-Bold-sub.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
:root {
  --navy: #1e2b3e; --navy2: #26364d; --navy3: #31435d;
  --paper: #f3ebdc; --paper2: #e8dcc5; --pline: #d6c7a8;
  --ink: #23262c; --psub: #6b6253;
  --cream: #efe6d6; --nsub: #a9b3c1; --nline: rgba(239, 230, 214, .16);
  --brass: #b48b58; --seal: #b0452e;
  --serif: 'S', 'Noto Serif KR', 'Nanum Myeongjo', serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--navy); }
body { background: var(--navy); color: var(--cream); font-family: 'P', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; font-weight: 400; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
#app { max-width: 480px; margin: 0 auto; padding: 18px 18px calc(36px + env(safe-area-inset-bottom)); }
button, input { font: inherit; color: inherit; }
.screen { display: none; animation: fade .35s ease; }
.screen.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.noimg { visibility: hidden; }
.center { text-align: center; }

/* 공통 글자 */
.tag { display: table; margin: 4px auto 0; padding: 3px 14px; border: 1px solid var(--brass); border-radius: 4px; color: var(--paper2); font-family: var(--serif); font-size: 13px; letter-spacing: .12em; }
h1 { font-family: var(--serif); font-size: 46px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; color: var(--paper); }
h2 { font-family: var(--serif); font-size: 25px; font-weight: 700; line-height: 1.35; }
h3 { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
h3 small { font-family: 'P'; font-size: 12px; color: var(--psub); font-weight: 400; margin-left: 6px; }
.fine { color: var(--nsub); font-size: 12px; margin-top: 12px; }
.seal { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 40px; border: 2px solid var(--seal); border-radius: 4px; color: var(--seal); font-family: var(--serif); font-size: 13px; line-height: 1.15; text-align: center; opacity: .9; transform: rotate(-4deg); }

/* 버튼 */
.btns { display: grid; gap: 10px; margin: 20px 0 10px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; border: 1px solid var(--nline); background: var(--navy2); color: var(--cream); border-radius: 10px; padding: 15px 10px; font-size: 17px; font-weight: 700; cursor: pointer; }
.btn.main { background: var(--paper); border-color: var(--paper); color: var(--navy); }
.btn.line { background: transparent; border-color: var(--brass); color: var(--paper2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--nsub); }
.btn:active { transform: scale(.98); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .btn { font-size: 15.5px; padding: 14px 6px; }
.ic-cam { width: 20px; height: 15px; border: 2px solid currentColor; border-radius: 4px; position: relative; display: inline-block; }
.ic-cam::after { content: ''; position: absolute; width: 6px; height: 6px; border: 2px solid currentColor; border-radius: 50%; left: 5px; top: 2.5px; box-sizing: content-box; width: 3px; height: 3px; }

/* 첫 화면 */
.hero { text-align: center; padding: 6px 0 0; }
.title-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 4px; }
.sub { color: var(--nsub); font-size: 14px; }
.plate { margin: 18px 0 0; background: var(--paper); border-radius: 10px; padding: 8px 8px 0; border: 1px solid var(--pline); }
#teacher { display: block; width: 100%; aspect-ratio: 1 / .9; object-fit: cover; object-position: center 20%; border-radius: 6px; }
.plate figcaption { color: var(--ink); text-align: left; padding: 12px 8px 12px; font-size: 15.5px; line-height: 1.55; }
.plate figcaption small { display: block; color: var(--psub); font-size: 12px; margin-top: 4px; }
.safe { color: var(--nsub); font-size: 13px; line-height: 1.55; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--nline); }
.safe b { color: var(--paper2); }

/* 사진 찍기 */
.topbar { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; min-height: 44px; border-bottom: 1px solid var(--nline); margin: -4px -2px 0; }
.topbar b { text-align: center; font-family: var(--serif); font-size: 18px; color: var(--paper); }
.back { background: none; border: 0; color: var(--paper); font-size: 30px; line-height: 1; width: 44px; height: 44px; text-align: left; cursor: pointer; }
.step { color: var(--brass); font-size: 13px; min-width: 44px; text-align: right; }
#photo-title { font-size: 19px; margin: 14px 0 0; color: var(--cream); text-align: center; }
.name-in { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--nsub); margin: 12px 0 0; border-bottom: 1px solid var(--brass); padding: 2px 2px 6px; }
.name-in span { flex: none; }
.name-in input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; padding: 6px 0; font-size: 16px; color: var(--paper); }
.name-in input::placeholder { color: #7c879a; }
.frame { position: relative; height: min(58vh, 430px); min-height: 330px; margin: 14px 0 0; border-radius: 10px; overflow: hidden; background: var(--navy2); }
#cam-preview { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.guide { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cn { position: absolute; width: 34px; height: 34px; border: 0 solid rgba(239, 230, 214, .85); }
.cn.tl { left: 14%; top: 9%; border-left-width: 2px; border-top-width: 2px; border-top-left-radius: 6px; }
.cn.tr { right: 14%; top: 9%; border-right-width: 2px; border-top-width: 2px; border-top-right-radius: 6px; }
.cn.bl { left: 14%; bottom: 9%; border-left-width: 2px; border-bottom-width: 2px; border-bottom-left-radius: 6px; }
.cn.br { right: 14%; bottom: 9%; border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 6px; }
.ln { position: absolute; left: 14%; right: 14%; height: 0; border-top: 1px dashed rgba(239, 230, 214, .55); }
.ln.l1 { top: 30%; } .ln.l2 { top: 52%; } .ln.l3 { top: 74%; }
.ln em { position: absolute; left: -2px; top: -11px; transform: translateX(-100%); font-style: normal; font-size: 11px; color: var(--navy); background: var(--paper); border-radius: 3px; padding: 1px 5px; line-height: 1.6; }
.frame p { position: absolute; z-index: 2; left: 0; right: 0; top: 41%; transform: translateY(-50%); font-size: 13.5px; color: var(--nsub); text-align: center; line-height: 1.45; padding: 0 22%; }
.frame.live { background: #111820; }
/* 카메라가 켜지면 밝은 배경에서도 보이게: 흰 선 + 아래 어두운 그림자 */
.frame.live .ln { border-top: 1.5px dashed rgba(255, 255, 255, .9); filter: drop-shadow(0 1px 0 rgba(10, 16, 26, .55)); }
.frame.live .cn { border-color: #fff; filter: drop-shadow(0 0 1.5px rgba(10, 16, 26, .7)); }
#cam-preview[hidden], .shutter-row[hidden], .frame p[hidden] { display: none; }
.shutter-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; margin: 18px 0 0; }
.shutter { width: 74px; height: 74px; border-radius: 50%; background: var(--paper); border: 0; box-shadow: 0 0 0 4px var(--navy), 0 0 0 6px var(--paper); cursor: pointer; }
.shutter:active { transform: scale(.94); }
.round-sm { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; color: var(--paper2); font-size: 12px; cursor: pointer; }
.ghost-slot { visibility: hidden; }
.ic-album { width: 26px; height: 22px; border: 2px solid currentColor; border-radius: 4px; position: relative; display: block; }
.ic-album::before { content: ''; position: absolute; right: 4px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.ic-album::after { content: ''; position: absolute; left: 2px; right: 2px; bottom: 2px; height: 9px; background: currentColor; clip-path: polygon(0 100%, 35% 15%, 60% 65%, 75% 40%, 100% 100%); }
.ic-x { width: 26px; height: 26px; position: relative; display: block; }
.ic-x::before, .ic-x::after { content: ''; position: absolute; left: 12px; top: 2px; width: 2px; height: 22px; background: currentColor; transform: rotate(45deg); }
.ic-x::after { transform: rotate(-45deg); }
.shutter-tip { text-align: center; color: var(--nsub); font-size: 13px; margin-top: 12px; }
.err { color: #e8a08e; font-size: 15px; margin-top: 8px; min-height: 1em; text-align: center; }

/* 스캔 */
#s-scan { padding-top: 6px; }
.scan-box { position: relative; margin: 14px auto 14px; width: 100%; max-width: 340px; border-radius: 10px; overflow: hidden; background: #111820; border: 1px solid var(--nline); }
#scan { display: block; width: 100%; height: auto; }
.sweep { position: absolute; left: 0; right: 0; height: 2px; top: 0; background: rgba(239, 230, 214, .8); box-shadow: 0 0 14px 4px rgba(180, 139, 88, .35); animation: sweep 2.4s ease-in-out infinite alternate; }
@keyframes sweep { to { top: calc(100% - 2px); } }
.say { font-size: 16px; color: var(--cream); text-align: center; margin: 6px 4px; min-height: 3.2em; }
.bar { height: 3px; background: var(--nline); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; width: 0; background: var(--brass); transition: width .3s; }
.scan-fail { display: grid; gap: 10px; margin-top: 14px; }
.scan-fail[hidden] { display: none; }

/* 결과: 한지 기록표 */
.sheet { position: relative; display: block; background: var(--paper); color: var(--ink); border-radius: 8px; padding: 22px 18px; margin-top: 14px; border: 1px solid var(--pline); }
.sheet .no { position: absolute; left: 14px; top: 14px; color: var(--seal); border: 1.5px solid var(--seal); border-radius: 3px; padding: 0 6px; font-family: var(--serif); font-size: 13px; transform: rotate(-5deg); opacity: .9; }
.sheet .who { text-align: center; color: var(--psub); font-size: 14px; margin-top: 14px; }
.sheet h2 { text-align: center; color: var(--ink); font-size: 26px; margin-top: 4px; }
.sheet .seal.sm { position: absolute; right: 14px; bottom: 14px; width: 26px; height: 34px; font-size: 11px; }
.animal { text-align: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--pline); }
.animal img { width: 74%; max-width: 260px; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--paper2); display: block; margin: 0 auto 10px; }
.animal b { font-family: var(--serif); font-size: 22px; color: var(--navy); display: block; }
.animal p { font-size: 15px; color: var(--psub); }
.body { font-size: 15.5px; margin: 12px 2px 0; padding-right: 30px; }
.fold { padding: 16px 18px; }
.fold summary { font-family: var(--serif); font-size: 18px; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '펼치기'; font-family: 'P'; font-size: 12px; color: var(--psub); font-weight: 400; }
.fold[open] summary::after { content: '접기'; }
.parts { list-style: none; margin-top: 8px; }
.parts li { padding: 12px 0; border-top: 1px solid var(--pline); }
.parts li small { color: var(--brass); font-size: 12.5px; display: block; font-weight: 700; }
.parts li b { font-family: var(--serif); font-size: 16.5px; display: block; color: var(--navy); }
.parts li p { font-size: 15px; color: #45413a; margin-top: 2px; }
.luck { display: grid; gap: 12px; }
.luck .row { display: grid; grid-template-columns: 52px 1fr 30px; gap: 10px; align-items: center; font-size: 15px; }
.luck .row b { font-weight: 800; color: var(--navy); }
.luck .row .t { height: 7px; background: var(--paper2); border-radius: 4px; overflow: hidden; }
.luck .row .t i { display: block; height: 100%; background: var(--navy); border-radius: 4px; width: 0; transition: width 1s ease; }
.luck .row em { font-style: normal; text-align: right; color: var(--psub); }
.luck p { grid-column: 1 / -1; font-size: 14px; color: #45413a; margin-top: -6px; }
.teacher-say { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; }
.teacher-say img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--brass); }
.teacher-say p { background: var(--navy2); border: 1px solid var(--nline); border-radius: 10px; padding: 12px 14px; font-size: 15.5px; color: var(--cream); }
.teacher-say b { display: block; color: var(--brass); font-size: 13px; }

/* 가족 결과 */
.sheet h2.center { font-size: 24px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.pair div { text-align: center; }
.pair img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--paper2); border: 1px solid var(--pline); }
.pair b { display: block; font-family: var(--serif); font-size: 17px; margin-top: 6px; color: var(--ink); }
.pair span { font-size: 13px; color: var(--navy); font-weight: 700; }
.pair p { font-size: 12.5px; color: var(--psub); line-height: 1.4; margin-top: 2px; }
.score { display: flex; justify-content: center; margin: 18px 0 6px; }
.score .ring { width: 120px; height: 120px; border-radius: 50%; border: 2px solid var(--seal); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--seal); transform: rotate(-3deg); }
.score b { font-family: var(--serif); font-size: 36px; line-height: 1.1; }
.score small { font-size: 12px; }
.chem { font-size: 15.5px; text-align: center; margin-top: 8px; }
.same { list-style: none; }
.same li { padding: 10px 0; border-top: 1px solid var(--pline); font-size: 15px; }
.same li b { color: var(--navy); }

/* 결과 아래: 다른 앱·매장 */
.after { display: none; border-top: 1px solid var(--nline); margin-top: 28px; padding-top: 6px; }
.after.on { display: block; }
.after h3 { color: var(--paper); margin-top: 26px; }
.sister { display: grid; gap: 8px; margin-top: 18px; }
.sister a { display: block; background: var(--navy2); border: 1px solid var(--nline); border-radius: 10px; padding: 12px 14px; color: var(--cream); text-decoration: none; font-size: 15px; }
.shop { background: var(--paper); color: var(--ink); border: 1px solid var(--pline); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.shop.main { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.shop b { font-size: 16px; font-weight: 800; }
.shop b small { font-size: 12px; color: var(--psub); font-weight: 400; margin-left: 6px; }
.shop .intro { font-size: 14px; color: var(--navy); margin-top: 2px; }
.shop p { font-size: 14px; color: var(--psub); margin-top: 4px; }
.shop a { display: inline-block; margin-top: 8px; color: var(--navy); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.more-shop summary { cursor: pointer; padding: 12px 2px; color: var(--nsub); font-size: 15px; }
/* 11/12 매장 현장 혜택 박스(지도 링크 위) */
.shop .perk { margin-top: 10px; padding: 10px 12px; border-radius: 6px; background: #ece0c4; border: 1px solid #d8c294; color: #5e4518; font-size: 14px; font-weight: 700; line-height: 1.45; }

/* 결과 그림 미리보기 */
.pop { display: none; position: fixed; inset: 0; background: rgba(12, 17, 25, .8); z-index: 9; align-items: center; justify-content: center; padding: 18px; }
.pop.on { display: flex; }
.pop > div { background: var(--navy2); border-radius: 12px; padding: 14px; width: 100%; max-width: 380px; max-height: 92vh; overflow: auto; text-align: center; }
.pop img { width: 100%; border-radius: 6px; display: block; }
.pop p { font-size: 13px; color: var(--nsub); margin: 8px 0; }
.pop .btn { margin-top: 8px; width: 100%; }
