:root {
  --ink: #262626;
  --paper: #fff;
  --paper-2: #efefef;
  --paper-3: #fafafa;
  --hair: #dbdbdb;
  --muted: #737373;
  --blue: #0095f6;
  --blue-deep: #1877f2;
  --link: #00376b;
  --stop: #ed4956;
  --go: #12b76a;
  --grad: linear-gradient(45deg, #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
  --display: 'Do Hyeon', 'Pretendard Variable', 'Malgun Gothic', sans-serif;
  --body: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--ink); font: 400 14px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .4; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
input, textarea { font: inherit; color: inherit; }

.ico { display: inline-flex; width: 24px; height: 24px; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }
.ico-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border-radius: 50%; }
.ico-btn:hover { opacity: .6; }

/* 버튼: 파란색이 "지금 할 일", 나머지는 옅은 회색 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 8px; font-weight: 600; font-size: 14px; background: var(--paper-2); color: var(--ink); }
.btn:hover:not(:disabled) { background: var(--hair); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--blue-deep); }
.btn.ghost { background: transparent; font-weight: 600; color: var(--muted); padding: 0 8px; }
.btn.ghost:hover:not(:disabled) { background: transparent; color: var(--ink); }
.btn.danger { color: var(--stop); }
.btn.wide { width: 100%; }

/* 입장 화면: 뒤의 거리가 보이도록 위쪽에 작게 둔다. 휴대폰 세로에서 화면의 30% 안쪽이다 */
#entry { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding: calc(8px + var(--safe-t)) 8px 8px; overflow: hidden auto; pointer-events: none; }
.entry-ticket { --stage-h: clamp(84px, 13dvh, 112px); pointer-events: auto; width: min(480px, 100%); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; background: var(--paper); padding: 12px 14px; border-radius: 18px; box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.entry-head { display: flex; align-items: center; gap: 12px; }
.entry-head .fine { font-size: 11px; line-height: 1.35; }
.entry-ticket h1 { flex: none; font: 400 30px/1.05 var(--display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input { min-height: 40px; padding: 0 12px; border: 1px solid var(--hair); border-radius: 8px; background: var(--paper-3); }
.field input:focus { outline: 0; border-color: #a8a8a8; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--hair); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--paper-2); font-size: 13px; font-weight: 600; }
.chip[aria-pressed='true'] { background: var(--ink); color: #fff; }
.entry-look { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.entry-stage { width: calc(var(--stage-h) * .78); height: var(--stage-h); display: block; background: var(--paper-3); border: 1px solid var(--paper-2); border-radius: 12px; }
.entry-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: space-between; min-width: 0; }
.entry-name { display: flex; gap: 6px; }
/* 글자 크기가 16px보다 작으면 iOS가 입력할 때 화면을 확대한다 */
.entry-name input { flex: 1; min-width: 0; min-height: 38px; padding: 0 10px; font-size: 16px; font-weight: 600; border: 1px solid var(--hair); border-radius: 8px; background: var(--paper-3); }
.entry-name input:focus { outline: 0; border-color: #a8a8a8; }
.entry-name .btn { flex: none; min-height: 38px; padding: 0 10px; font-size: 12px; }
.entry-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.entry-buttons .btn { min-height: 36px; padding: 0 6px; font-size: 13px; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.5; }
.invite-banner { background: var(--paper-3); border: 1px solid var(--hair); padding: 6px 10px; font-size: 12px; border-radius: 10px; }

/* 옷장 */
.closet { position: fixed; inset: 0; z-index: 45; background: var(--paper); color: var(--ink); display: grid; grid-template-columns: minmax(240px, 34%) 1fr; }
.closet-left { display: flex; flex-direction: column; padding: 16px; gap: 8px; min-height: 0; background: var(--paper-3); border-right: 1px solid var(--hair); }
.closet-left h2 { font-size: 20px; font-weight: 700; line-height: 1.2; }
.closet-stage { flex: 1; min-height: 0; width: 100%; display: block; cursor: grab; }
.closet-summary { font-size: 13px; color: var(--muted); min-height: 2.8em; }
.closet-rolls { display: flex; gap: 6px; }
.closet-rolls .btn { flex: 1; }
.closet-right { background: var(--paper); color: var(--ink); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.closet-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--hair); flex: none; }
.closet-tab { flex: 1 0 auto; min-height: 46px; padding: 0 12px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 1px solid transparent; margin-bottom: -1px; }
.closet-tab[aria-selected='true'] { color: var(--ink); border-color: var(--ink); }
.closet-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; align-content: start; }
.closet-opt { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; background: var(--paper); border: 1px solid var(--paper-2); border-radius: 12px; font-size: 12px; line-height: 1.25; font-weight: 500; }
.closet-opt canvas { width: 72px; height: 72px; display: block; }
.closet-opt:hover { border-color: var(--hair); }
.closet-opt[aria-pressed='true'] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.closet-foot { flex: none; display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--hair); }
.closet-foot .btn.primary { flex: 1; }

/* 위쪽 막대 */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * > *, #hud button { pointer-events: auto; }
#hud-top { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; }
.hud-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; background: rgba(255,255,255,.94); color: var(--ink); border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: 0 1px 6px rgba(0,0,0,.18); backdrop-filter: blur(8px); }
button.pill:hover { background: #fff; }
.pill .ico { width: 18px; height: 18px; }
.pill strong { font-weight: 700; font-size: 13.5px; }
.pill .sub { color: var(--muted); font-size: 12px; font-weight: 500; }

/* 아래쪽 탭 막대 */
#hud-menu { position: absolute; left: 0; right: 0; bottom: calc(12px + var(--safe-b)); display: flex; justify-content: center; }
.tabbar { display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center; gap: 2px; width: min(500px, calc(100vw - 20px)); min-height: 58px; padding: 4px 6px; background: rgba(255,255,255,.96); border-radius: 18px; box-shadow: 0 4px 22px rgba(0,0,0,.25); backdrop-filter: blur(10px); }
.tab-item { display: grid; justify-items: center; gap: 1px; min-height: 48px; padding: 4px 2px; font-size: 11px; font-weight: 500; border-radius: 10px; }
.tab-item:hover:not(:disabled) { background: var(--paper-3); }
.tab-post { display: inline-flex; align-items: center; gap: 4px; min-height: 42px; padding: 0 16px 0 10px; background: var(--grad); color: #fff; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 8px rgba(214,41,118,.4); }
.tab-post:hover:not(:disabled) { filter: brightness(1.06); }
.tab-post .ico { width: 20px; height: 20px; }

#hud-context { position: absolute; left: 50%; bottom: calc(82px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 6px; align-items: center; max-width: calc(100vw - 20px); flex-wrap: wrap; justify-content: center; }
.place-bar { background: rgba(255,255,255,.95); padding: 5px; display: flex; gap: 6px; align-items: center; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: 0 2px 12px rgba(0,0,0,.22); }
.place-bar > span { padding: 0 8px 0 10px; }
.place-bar .btn { min-height: 34px; font-size: 13px; padding: 0 14px; border-radius: 999px; }

#hud-reactions { position: absolute; left: 50%; bottom: calc(134px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 8px; width: min(500px, calc(100vw - 20px)); justify-content: center; }
.react-btn { width: 54px; height: 54px; padding: 6px; background: rgba(255,255,255,.96); border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.24); transition: transform .12s; }
.react-btn:hover { transform: scale(1.08); }
.react-btn:active { transform: scale(.9); }
.react-btn canvas { width: 100%; height: 100%; display: block; }

/* 조이스틱 */
#hud-stick { position: absolute; left: 22px; bottom: calc(22px + var(--safe-b)); }
.stick { width: 124px; height: 124px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.26); border: 2px solid rgba(255,255,255,.75); box-shadow: 0 2px 14px rgba(0,0,0,.28); backdrop-filter: blur(4px); touch-action: none; cursor: grab; user-select: none; }
.stick.on { background: rgba(255,255,255,.38); cursor: grabbing; }
.stick-knob { width: 54px; height: 54px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); pointer-events: none; }

/* 대기 카드 */
#hud-ticket { position: absolute; left: 10px; top: calc(56px + var(--safe-t)); }
.q-ticket { width: 226px; background: var(--paper); padding: 13px 14px 8px; border-radius: 16px; box-shadow: 0 4px 22px rgba(0,0,0,.25); }
.q-ticket .store { font-size: 13px; font-weight: 600; }
.q-ticket .big { font-size: 34px; font-weight: 800; line-height: 1.1; margin: 2px 0 1px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.q-ticket .eta { font-size: 13px; color: var(--muted); }
.q-ticket hr { border: 0; border-top: 1px solid var(--paper-2); margin: 9px 0 6px; }
.q-ticket .row { display: flex; gap: 3px; flex-wrap: wrap; justify-content: space-between; }
.q-ticket .row .btn { min-height: 34px; padding: 0 10px; font-size: 13px; }
.q-ticket .assure { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* 호출: 스토리처럼 위쪽 막대가 줄어든다. 이 화면이 제품에서 가장 큰 순간이다 */
#signal { position: fixed; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 24px)); background: var(--paper); color: var(--ink); border-radius: 22px; padding: 28px 20px 18px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.sig-side { display: flex; justify-content: center; margin-bottom: 10px; }
.sig-lamp { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px #d62976; }
.sig-lamp svg { width: 40px; height: 60px; fill: currentColor; }
.sig-bars { position: absolute; top: 12px; left: 16px; right: 16px; height: 3px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.sig-bars i { background: var(--paper-2); border-radius: 2px; }
.sig-bars i.on { background: #d62976; }
.sig-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sig-body h2 { font-size: 24px; font-weight: 800; line-height: 1.2; }
.sig-body .store { font-size: 14px; color: var(--muted); }
.sig-count { font-size: 18px; font-weight: 700; color: #d62976; }
.sig-rule { font-size: 12px; color: var(--muted); }
.sig-go { min-height: 50px; width: 100%; background: var(--grad); color: #fff; font-size: 18px; font-weight: 800; border-radius: 12px; }
.sig-go:hover:not(:disabled) { filter: brightness(1.06); }

/* 시트 */
#sheet { position: fixed; z-index: 40; right: 10px; top: calc(10px + var(--safe-t)); bottom: calc(10px + var(--safe-b)); width: min(420px, calc(100vw - 20px)); background: var(--paper); border-radius: 16px; box-shadow: 0 10px 44px rgba(0,0,0,.4); display: flex; flex-direction: column; overflow: hidden; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--paper-2); }
.sheet-head h2 { font-size: 17px; font-weight: 700; line-height: 1.25; }
.sheet-head .kind { font-size: 12px; font-weight: 500; color: var(--muted); }
.sheet-close { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border-radius: 50%; flex: none; }
.sheet-close:hover { background: var(--paper-3); }
.sheet-close .ico { width: 22px; height: 22px; }
.sheet-body { padding: 12px 16px 16px; overflow-y: auto; flex: 1; }
.sheet-foot { padding: 10px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--paper-2); display: grid; gap: 6px; }

.q-now { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--paper-2); border-bottom: 1px solid var(--paper-2); margin: 8px 0 10px; }
.q-now .num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.q-now .txt { font-size: 13px; color: var(--muted); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--go); vertical-align: 1px; }
.status-dot.wait { background: #fa7e1e; }
.status-dot.stop { background: var(--stop); }
.para { margin-bottom: 8px; }
.warn { background: var(--paper-3); border: 1px solid var(--hair); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 8px; }
.warn .btn { margin-top: 6px; min-height: 34px; font-size: 13px; }
.preview-list { list-style: none; margin: 0; padding: 0; }
.preview-list li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--paper-2); }
.preview-list b { display: block; font-weight: 600; }
.preview-list small { color: var(--muted); font-size: 13px; }

/* 포장 모양 */
.pack { width: 40px; height: 40px; position: relative; display: block; }
.pack i { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: block; background: var(--c, #999); border-radius: 3px; box-shadow: inset -5px 0 0 rgba(0,0,0,.13); }
.pack.poster i { width: 28px; height: 40px; }

/* 체험 패널 */
#exp { position: fixed; z-index: 30; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); width: min(560px, calc(100vw - 20px)); background: var(--paper); border-radius: 18px; padding: 16px; box-shadow: 0 10px 44px rgba(0,0,0,.4); max-height: 62vh; overflow-y: auto; }
#exp h2 { font-size: 19px; font-weight: 700; line-height: 1.25; margin-bottom: 4px; }
#exp .where { font-size: 12px; font-weight: 500; color: var(--muted); }
.exp-actions { display: flex; gap: 6px; margin-top: 12px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.exp-actions .btn.primary { flex: 1 1 180px; }
.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.opt { display: grid; gap: 4px; padding: 10px 8px; background: var(--paper); border: 1px solid var(--paper-2); border-radius: 12px; text-align: left; align-content: start; }
.opt:hover { border-color: var(--hair); background: var(--paper-3); }
.opt canvas { width: 56px; height: 56px; }
.opt-grid.many { grid-template-columns: repeat(4, 1fr); }
.opt-head { font-size: 14px; font-weight: 700; margin-top: 12px; }
.confirm-row { display: flex; gap: 10px; align-items: center; }
.confirm-row canvas { width: 72px; height: 72px; flex: none; }
.boards { display: grid; gap: 8px; }
.menu-board { width: 100%; height: auto; display: block; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.2); }
.opt b { font-weight: 600; font-size: 14px; line-height: 1.25; }
.opt small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.not-real { background: var(--paper-3); border: 1px solid var(--hair); color: var(--ink); padding: 9px 12px; font-size: 13px; font-weight: 600; margin: 10px 0 0; border-radius: 10px; }
.progress { height: 4px; background: var(--paper-2); margin-top: 12px; overflow: hidden; border-radius: 2px; }
.progress i { display: block; height: 100%; width: 100%; background: var(--grad); transform-origin: left; animation: fill var(--dur, 3s) linear forwards; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.popup-make { display: grid; grid-template-columns: 1fr 112px; gap: 12px; margin-top: 6px; }
.popup-make canvas { width: 112px; height: 150px; display: block; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.popup-make .lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 0 4px; }
.guide { font-size: 13px; background: var(--paper-3); padding: 8px 12px; margin-top: 10px; border-radius: 10px; }

.empty { padding: 22px 0; color: var(--muted); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--paper-2); }
.set-row small { display: block; color: var(--muted); font-size: 12px; }
.set-row .btn { min-height: 32px; font-size: 13px; padding: 0 12px; }
.toggle { min-width: 58px; min-height: 32px; background: var(--paper-2); border-radius: 999px; font-size: 13px; font-weight: 600; }
.toggle[aria-pressed='true'] { background: var(--blue); color: #fff; }
.set-title { font-size: 15px; font-weight: 700; margin: 18px 0 4px; }
.code { font-size: 26px; font-weight: 800; letter-spacing: .1em; }

/* 랜드마크 안 */
.place-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.place-actions .btn { min-height: 38px; font-size: 13px; }
.place-actions .btn.far { color: var(--muted); }
#exp.place-panel { padding: 10px 12px; width: min(620px, calc(100vw - 20px)); }
#exp.place-panel .where { font-size: 11.5px; }
#exp.place-panel .exp-actions { margin-top: 6px; }
#exp.place-panel .btn { min-height: 34px; font-size: 13px; padding: 0 12px; }
#exp.place-panel .btn.primary { flex: 0 1 auto; }
.place-list { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; }

/* 구도 잡기: 캔버스 조작이 그대로 통하도록 버튼만 누를 수 있다 */
body.framing #hud, body.framing #exp, body.framing #labels { display: none; }
#framer { position: fixed; inset: 0; z-index: 35; overflow: hidden; pointer-events: none; color: #fff; }
.frame-window { position: absolute; border-radius: 2px; box-shadow: 0 0 0 200vmax rgba(0,0,0,.66); background-image: linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.4) calc(33.33% - .5px), rgba(255,255,255,.4) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.4) calc(66.66% - .5px), rgba(255,255,255,.4) calc(66.66% + .5px), transparent calc(66.66% + .5px)), linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.4) calc(33.33% - .5px), rgba(255,255,255,.4) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.4) calc(66.66% - .5px), rgba(255,255,255,.4) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.frame-flash { position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity .2s; }
.frame-flash.on { opacity: .9; transition: none; }
.frame-head { position: absolute; top: calc(8px + var(--safe-t)); left: 8px; right: 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; font-size: 15px; }
.frame-head button { pointer-events: auto; justify-self: start; }
.frame-place { justify-self: end; display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 500; }
.frame-place .ico { width: 16px; height: 16px; }
.frame-foot { position: absolute; left: 0; right: 0; bottom: calc(10px + var(--safe-b)); display: grid; justify-items: center; gap: 5px; font-size: 13px; }
.frame-foot p { font-size: 12px; opacity: .85; }
.frame-foot b { font-size: 12px; }
.shutter { pointer-events: auto; width: 62px; height: 62px; border-radius: 50%; padding: 4px; background: var(--grad); }
.shutter i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; border: 3px solid #000; }
.shutter:active i { background: #dbdbdb; }

/* 피드 */
#sheet[data-kind='feed'] .sheet-body { padding: 0; }
.post { border-bottom: 1px solid var(--paper-2); padding-bottom: 12px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; }
.story-ring { flex: none; width: 38px; height: 38px; padding: 2px; border-radius: 50%; background: var(--grad); display: block; }
.story-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: #fff; border: 2px solid #fff; font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 20px var(--paper-2); }
.post-who { flex: 1; min-width: 0; line-height: 1.25; }
.post-who b { display: block; font-size: 13.5px; font-weight: 600; }
.post-who small { display: block; font-size: 12px; color: var(--muted); }
.post-media { position: relative; background: var(--paper-2); cursor: pointer; }
.post-media img { width: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.post-heart { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: #fff; opacity: 0; pointer-events: none; filter: drop-shadow(0 2px 10px rgba(0,0,0,.4)); }
.post-heart .ico { width: 100%; height: 100%; }
.post-heart svg { fill: currentColor; }
.post-heart.on { animation: heart-pop .8s ease-out; }
@keyframes heart-pop { 0% { opacity: 0; transform: scale(.4); } 18% { opacity: 1; transform: scale(1.15); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }
.post-acts { display: flex; align-items: center; gap: 0; padding: 2px 4px; }
.ico-btn.like[aria-pressed='true'] { color: var(--stop); }
.ico-btn.like[aria-pressed='true'] svg { fill: currentColor; }
.post-more { display: flex; gap: 6px; padding: 2px 12px 8px; flex-wrap: wrap; }
.post-more .btn { min-height: 32px; font-size: 13px; padding: 0 12px; }
.post-likes { padding: 0 14px; font-weight: 600; font-size: 13.5px; }
.post-caption { padding: 3px 14px 0; font-size: 13.5px; white-space: pre-line; word-break: break-word; }
.post-caption b { font-weight: 600; }
.post-caption .tag { color: var(--link); }
.post-time { display: block; padding: 4px 14px 0; font-size: 11.5px; color: var(--muted); }
.post-edit { display: block; width: calc(100% - 24px); margin: 4px 12px 0; padding: 8px 10px; border: 1px solid var(--hair); border-radius: 8px; resize: vertical; }
.post-edit-acts { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 12px 0; }
.post-edit-acts .btn { min-height: 32px; font-size: 13px; }
.feed-fine { padding: 14px 16px 18px; }
.feed-empty { display: grid; justify-items: center; gap: 6px; padding: 52px 24px 28px; text-align: center; }
.feed-empty b { font-size: 18px; font-weight: 800; }
.feed-empty p { color: var(--muted); margin-bottom: 10px; }
.feed-empty-ring { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 6px; border-radius: 50%; background: var(--grad); color: #fff; }
.feed-empty-ring .ico { width: 36px; height: 36px; }

/* 대화상자 */
#dialog-root:empty { display: none; }
#dialog-root { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--paper); width: min(360px, 100%); padding: 20px; border-radius: 16px; box-shadow: 0 20px 56px rgba(0,0,0,.45); }
.dialog h2 { font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.dialog .acts { display: flex; gap: 6px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; }
.dialog .acts .btn.primary { flex: 1 1 140px; }

/* 안내 */
#toasts { position: fixed; z-index: 70; top: calc(54px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: grid; gap: 6px; width: min(400px, calc(100vw - 20px)); justify-items: center; pointer-events: none; }
.toast { background: rgba(38,38,38,.95); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.toast.alert { background: #fff; color: var(--stop); }
#overlay { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.72); color: #fff; display: grid; place-items: center; text-align: center; padding: 20px; }
#overlay h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
#overlay .btn { margin-top: 12px; }

/* 거리 위 표지 */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.w-label { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; font-size: 12px; font-weight: 600; }
.w-name { background: rgba(38,38,38,.72); color: #fff; padding: 1px 8px; border-radius: 999px; }
.w-name.party { background: #d62976; }
.w-bubble { background: #fff; color: var(--ink); padding: 6px 12px; border-radius: 16px 16px 16px 4px; font-size: 13px; box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.w-store { pointer-events: auto; cursor: pointer; background: #fff; color: var(--ink); padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 500; box-shadow: 0 3px 12px rgba(0,0,0,.35); border: 0; }
.w-store b { font-weight: 700; margin-right: 5px; }

@media (max-width: 640px) {
  .closet { grid-template-columns: 1fr; grid-template-rows: 38dvh 1fr; }
  .closet-left { padding: 8px 10px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--hair); }
  .closet-left h2 { font-size: 17px; }
  .closet-summary { display: none; }
  .closet-rolls .btn { min-height: 36px; font-size: 13px; }
  .closet-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); padding: 6px; }
  .closet-opt canvas { width: 58px; height: 58px; }
  .pill-text { display: none; }
  .pill { padding: 0 10px; }
  #place-pill .sub { display: none; }
  #hud-ticket { top: calc(52px + var(--safe-t)); left: 8px; }
  .q-ticket { width: 186px; padding: 10px 11px 6px; }
  .q-ticket .big { font-size: 28px; }
  #hud-menu { bottom: 0; }
  #hud-stick { left: 16px; bottom: calc(76px + var(--safe-b)); }
  .stick { width: 112px; height: 112px; }
  .stick-knob { width: 48px; height: 48px; }
  .tabbar { width: 100%; border-radius: 0; box-shadow: none; border-top: 1px solid var(--hair); padding: 3px 4px calc(3px + var(--safe-b)); background: #fff; }
  .tab-post { padding: 0 12px 0 8px; font-size: 13px; }
  #hud-context { left: 140px; right: 8px; transform: none; bottom: calc(76px + var(--safe-b)); justify-content: flex-end; max-width: none; }
  #hud-reactions { left: 140px; right: 8px; width: auto; transform: none; bottom: calc(126px + var(--safe-b)); justify-content: flex-end; }
  .react-btn { width: 48px; height: 48px; }
  #sheet { left: 0; right: 0; width: 100%; top: auto; bottom: 0; max-height: 86dvh; height: 86dvh; border-radius: 16px 16px 0 0; }
  #exp { width: calc(100vw - 12px); bottom: calc(6px + var(--safe-b)); padding: 12px; }
  .opt-grid { gap: 6px; }
  .opt-grid.many { grid-template-columns: repeat(3, 1fr); }
  .opt { padding: 8px 6px; }
  .popup-make { grid-template-columns: 1fr 88px; }
  .popup-make canvas { width: 88px; height: 118px; }
}
@media (max-height: 480px) {
  /* 가로로 눕힌 휴대폰: 들어가기 버튼을 옆으로 옮겨 높이를 줄인다 */
  #entry { padding-top: 4px; }
  .entry-ticket { --stage-h: 76px; grid-template-columns: minmax(0, 1fr) 96px; padding: 8px 12px; gap: 6px 10px; }
  .entry-head, .invite-banner { grid-column: 1 / -1; }
  .entry-ticket h1 { font-size: 24px; }
  .entry-actions .btn { height: 100%; padding: 0 8px; line-height: 1.25; word-break: keep-all; }
}
@media (max-height: 560px) {
  .frame-head { right: auto; width: 110px; grid-template-columns: 1fr; }
  .frame-head b, .frame-place, .frame-foot p { display: none; }
  .frame-foot { left: auto; right: 16px; bottom: 50%; transform: translateY(50%); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .progress i { animation: none; }
  .post-heart.on { animation-duration: .01s; }
}
