:root {
  --paper: #f6efe4; --paper2: #efe4d2; --ink: #2b2620; --ink2: #5d5345; --line: #d8c9b2;
  --wood: #b7793f; --wood-d: #8a5527; --green: #2f8f5b; --green-d: #22704a; --red: #d2483c; --blue: #3c6fd2; --gold: #e2a72e;
  --card: #fffaf2; --shadow: 0 6px 18px rgba(70, 50, 20, .14);
  --r: 16px; --font: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Nanum Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; min-height: 44px; }
.btn { background: var(--green); color: #fff; border-radius: 12px; padding: 10px 18px; font-weight: 700; box-shadow: 0 3px 0 var(--green-d); transition: transform .08s; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-d); }
.btn:disabled { background: #b9b1a3; box-shadow: 0 3px 0 #9a9284; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 3px 0 var(--line); border: 1px solid var(--line); }
.btn.wood { background: var(--wood); box-shadow: 0 3px 0 var(--wood-d); }
.btn.red { background: var(--red); box-shadow: 0 3px 0 #a3342a; }
.btn.small { padding: 6px 12px; font-size: 14px; min-width: 44px; min-height: 44px; } /* 터치 대상 44px — ⚙︎·← 가 34px 였다 */

#app { position: fixed; inset: 0; display: flex; flex-direction: column; height: 100dvh; }
.screen { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px; }
h1, h2, h3 { margin: .3em 0; line-height: 1.25; }
.muted { color: var(--ink2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.card.click { cursor: pointer; transition: transform .12s; } .card.click:hover { transform: translateY(-2px); }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--paper2); font-size: 13px; color: var(--ink2); margin: 2px 4px 2px 0; }
.chip.on { background: var(--green); color: #fff; }

/* 머리띠 */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.logo { font-weight: 900; font-size: 22px; letter-spacing: -.5px; display: flex; gap: 8px; align-items: center; }
.logo .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--wood); display: grid; place-items: center; color: #fff; font-size: 18px; }
.who { margin-left: auto; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.who .chip { white-space: nowrap; }
/* 좁은 화면(폰): 상단 막대에서 로고 글자를 빼고 칩을 한 줄로 — 로고·닉네임·단계가 두 줄로 꺾였다 */
@media (max-width: 480px) { .top .logo .lt { display: none; } .top { gap: 6px; padding-left: 12px; padding-right: 12px; } .who { gap: 4px; font-size: 13px; } .who .chip { padding: 3px 7px; } }

/* 골목(허브) */
.alley { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.shop { position: relative; border-radius: 18px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; transition: transform .12s; min-height: 210px; display: flex; flex-direction: column; }
.shop:hover { transform: translateY(-3px); }
.shop .roof { height: 96px; display: grid; place-items: center; position: relative; }
.shop .roof svg { width: 74px; height: 74px; }
.shop .awning { position: absolute; bottom: -10px; left: 0; right: 0; height: 20px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.85) 0 18px, transparent 18px 36px); clip-path: polygon(0 0,100% 0,100% 50%, 97% 100%, 94% 50%, 91% 100%, 88% 50%, 85% 100%, 82% 50%, 79% 100%, 76% 50%, 73% 100%, 70% 50%, 67% 100%, 64% 50%, 61% 100%, 58% 50%, 55% 100%, 52% 50%, 49% 100%, 46% 50%, 43% 100%, 40% 50%, 37% 100%, 34% 50%, 31% 100%, 28% 50%, 25% 100%, 22% 50%, 19% 100%, 16% 50%, 13% 100%, 10% 50%, 7% 100%, 4% 50%, 1% 100%, 0 50%); }
.shop .body { padding: 18px 14px 14px; flex: 1; }
.shop .stamp { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.9); border-radius: 999px; padding: 2px 9px; font-size: 13px; font-weight: 700; }

/* 작업 화면 */
#work { display: flex; flex-direction: column; overflow: hidden; }
.stagewrap { position: relative; flex: 1; min-height: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .tl { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.hud .tl > * { pointer-events: auto; }
.stepcard { background: rgba(255,250,242,.94); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 560px; }
.stepcard .k { font-size: 12px; color: var(--ink2); }
.stepcard .t { font-size: 18px; font-weight: 800; }
.stepcard .h { font-size: 14px; color: var(--ink2); margin-top: 2px; }
.prog { height: 8px; background: var(--paper2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.prog > i { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s; }
.steps { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.steps b { width: 12px; height: 6px; border-radius: 3px; background: var(--line); }
.steps b.on { background: var(--green); } .steps b.cur { background: var(--gold); }
.hud .br { position: absolute; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hud .bl { position: absolute; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 8px; flex-wrap: wrap; max-width: 60%; }
.tray { display: flex; gap: 6px; background: rgba(255,250,242,.94); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); flex-wrap: wrap; }
.tray button { min-width: 64px; padding: 6px 10px; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--paper2); }
.tray button.on { background: var(--green); color: #fff; }
.camhold { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,250,242,.94); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 22px; touch-action: none; }
.why { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); background: #fff3d6; border: 2px solid var(--gold); border-radius: 14px; padding: 10px 14px; max-width: min(560px, 90vw); box-shadow: var(--shadow); font-weight: 700; pointer-events: none; transition: opacity .3s; }
.why small { display: block; font-weight: 400; color: var(--ink2); margin-top: 2px; }
.readout { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-weight: 800; border-radius: 8px; padding: 3px 8px; font-size: 15px; transform: translate(-50%, -150%); white-space: nowrap; }
.handhint { position: absolute; pointer-events: none; font-size: 40px; transition: opacity .4s; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(40, 30, 20, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal .card { width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; }
.opts { display: grid; gap: 8px; margin: 10px 0; }
.opts button { text-align: left; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 700; }
.opts button.on { border-color: var(--green); background: #eaf6ef; }
.safety { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin: 10px 0; }
.safety button { border: 2px dashed var(--line); border-radius: 12px; padding: 10px; background: var(--card); text-align: center; }
.safety button.on { border: 2px solid var(--green); background: #eaf6ef; }
.safety .ic { font-size: 30px; display: block; }
input[type=range] { width: 100%; height: 36px; }

/* 결과 */
.stars { font-size: 28px; letter-spacing: 2px; color: var(--gold); }
.note { background: #fffdf7; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.note li { margin: 4px 0; }
.title-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.title-pick select { font: inherit; padding: 8px; border-radius: 10px; border: 1px solid var(--line); min-height: 44px; background: #fff; }

/* 전시관 */
.thumb { aspect-ratio: 4/3; background: linear-gradient(#f7f1e7, #e9dcc6); border-radius: 12px; display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.stk { display: inline-flex; gap: 4px; align-items: center; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; min-height: 40px; }
.stk.on { background: #fff3d6; border-color: var(--gold); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 16px; z-index: 80; max-width: 90vw; }
.skip { font-size: 13px; text-decoration: underline; color: var(--ink2); min-height: 44px; padding: 0 8px; }
@media (max-width: 600px) {
  .stepcard .t { font-size: 16px; } .hud .bl { max-width: 100%; bottom: 76px; } .why { top: 120px; }
}
