@font-face { font-family: "Gowun Dodum"; src: url("../../assets/fonts/GowunDodum-Regular.ttf") format("truetype"); font-display: swap; }
:root { --paper: #f6ecd6; --ink: #33251a; --accent: #b8443a; --gold: #e8b030; --green: #2f4a40; --line: #c9b48c; font-size: 16px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1612; color: var(--ink);
  font-family: "Gowun Dodum", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.hud { position: absolute; inset: 0; padding: max(12px, env(safe-area-inset-top)) 14px 14px; }
.card { background: rgba(246, 236, 214, .94); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 rgba(51, 37, 26, .35); }
.place { position: absolute; left: 14px; top: 12px; padding: 8px 14px; }
.place b { display: block; font-size: 1.05rem; } .place span { font-size: .95rem; opacity: .8; }
.wallet { position: absolute; right: 14px; top: 12px; padding: 8px 14px; font-size: 1.05rem; display: flex; gap: 14px; }
.tracker { position: absolute; left: 14px; top: 84px; max-width: min(330px, 62vw); padding: 10px 14px; border-left: 8px solid var(--gold); }
.tracker b { display: block; font-size: .92rem; color: var(--accent); margin-bottom: 2px; } .tracker span { font-size: 1.05rem; line-height: 1.35; }
.jobhud { position: absolute; right: 14px; top: 70px; padding: 10px 14px; width: 210px; font-size: 1rem; }
.jobhud .bar { height: 14px; border: 2px solid var(--ink); border-radius: 8px; background: #fff8; margin-top: 6px; overflow: hidden; }
.jobhud .bar i { display: block; height: 100%; background: var(--gold); width: 0; }
.jobhud .bar i.hot { background: var(--accent); }
.menu { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px; pointer-events: auto; }
.menu button { min-width: 64px; min-height: 56px; padding: 6px 10px; font-size: .95rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 rgba(51, 37, 26, .35); }
.menu button:active, .big-btn:active { transform: translateY(2px); box-shadow: none; }
.menu button span { display: block; font-size: 1.35rem; line-height: 1.1; }
.prompt { position: absolute; left: 50%; bottom: 24%; transform: translateX(-50%); padding: 10px 20px; font-size: 1.15rem; white-space: nowrap; pointer-events: auto; cursor: pointer; }
.prompt kbd { display: inline-block; background: var(--ink); color: var(--paper); border-radius: 6px; padding: 1px 9px; margin-right: 8px; font-family: inherit; }
.arrow { position: absolute; width: 0; height: 0; }
.arrow i { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); border: 2px solid var(--ink); display: grid; place-items: center; font-style: normal; font-weight: bold; }
.arrow span { position: absolute; top: 20px; left: -30px; width: 60px; text-align: center; font-size: .85rem; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.keys { position: absolute; left: 14px; bottom: 14px; padding: 8px 12px; font-size: .9rem; line-height: 1.5; opacity: .92; }

.toasts { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(520px, 90vw); }
.toast { padding: 10px 18px; font-size: 1.05rem; text-align: center; animation: pop .25s ease-out; transition: opacity .4s; }
.toast.quest { background: var(--green); color: var(--paper); } .toast.memory { background: #5a3a5a; color: #fff3da; }
.toast.bad { background: var(--accent); color: #fff; } .toast.good { background: #e9f0d6; }
@keyframes pop { from { transform: translateY(-10px); opacity: 0; } }

.dialogue { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(760px, 94vw); padding: 18px 22px 20px; pointer-events: auto !important; cursor: pointer; }
.dialogue .who { position: absolute; top: -18px; left: 18px; padding: 3px 16px; background: var(--ink); color: var(--paper); border-radius: 10px; font-size: 1.05rem; }
.dialogue.me .who { background: var(--green); }
.dialogue .text { font-size: 1.28rem; line-height: 1.6; min-height: 3.3em; white-space: pre-wrap; }
.dialogue.narr .text { font-style: normal; color: #4a3a5a; text-align: center; }
.dialogue .next { position: absolute; right: 16px; bottom: 6px; animation: bob 1s infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choices button { text-align: left; min-height: 50px; padding: 8px 16px; font-size: 1.15rem; background: #fffaf0; border: 2px solid var(--ink); border-radius: 10px; }
.choices button.focus, .choices button:hover { background: var(--gold); }
.choices button b { display: inline-block; width: 1.6em; color: var(--accent); }

.fade { position: absolute; inset: 0; background: #0d0a08; opacity: 0; transition: opacity .6s; display: grid; place-items: center; }
.fade.on { opacity: 1; pointer-events: auto !important; }
.fade div { color: #f6ecd6; font-size: 1.5rem; line-height: 1.9; text-align: center; white-space: pre-wrap; padding: 24px; }

.modal { position: absolute; inset: 0; background: rgba(20, 14, 10, .55); display: grid; place-items: center; pointer-events: auto !important; }
.panel { width: min(680px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 2px solid var(--ink); }
.panel header h2 { margin: 0; font-size: 1.35rem; }
.panel .body { padding: 14px 18px 18px; overflow-y: auto; font-size: 1.05rem; line-height: 1.5; }
.big-btn { min-height: 52px; padding: 8px 22px; font-size: 1.15rem; background: var(--gold); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 rgba(51, 37, 26, .35); pointer-events: auto; }
.big-btn.plain { background: #fffaf0; } .big-btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row .ico { font-size: 1.9rem; width: 2.4rem; text-align: center; flex: none; }
.row .grow { flex: 1; min-width: 0; } .row .grow small { display: block; opacity: .78; font-size: .92rem; }
.swatch { width: 2.2rem; height: 2.6rem; border: 2px solid var(--ink); border-radius: 8px; flex: none; }
.note { font-size: .9rem; opacity: .75; margin-top: 10px; }
.mem { padding: 12px 14px; margin-bottom: 10px; border: 2px solid var(--line); border-radius: 10px; background: #fffaf0; }
.mem.locked { opacity: .5; text-align: center; } .mem b { display: block; font-size: 1.1rem; margin-bottom: 4px; } .mem em { font-style: normal; font-size: .85rem; color: var(--accent); }
.q-done { opacity: .6; }
label.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
label.set input[type=range] { width: 50%; height: 30px; } label.set input[type=checkbox] { width: 28px; height: 28px; }

.title { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto !important;
  background: radial-gradient(ellipse at 50% 120%, #e8a060 0%, #8a5a6a 38%, #2a2440 72%, #14121e 100%); color: #f6ecd6; text-align: center; }
.title h1 { font-size: clamp(2.6rem, 9vw, 5rem); margin: 0 0 6px; letter-spacing: .12em; text-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.title p { font-size: clamp(1rem, 2.6vw, 1.3rem); line-height: 1.8; margin: 0 0 30px; opacity: .92; }
.title .btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.title .btns .big-btn { width: 260px; color: var(--ink); }
.title input { font: inherit; font-size: 1.3rem; padding: 10px 14px; width: 260px; text-align: center; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink); -webkit-user-select: text; user-select: text; }
.title small { display: block; margin-top: 26px; opacity: .7; font-size: .9rem; }

.minigame { position: absolute; inset: 0; background: rgba(20, 14, 10, .7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: auto !important; }
.minigame canvas { max-width: min(720px, 94vw); max-height: 62vh; width: auto; height: auto; border: 3px solid var(--ink); border-radius: 12px; }
.mg-quit { background: none; border: 0; color: #f6ecd6; text-decoration: underline; font-size: 1rem; min-height: 44px; }

.touch { position: absolute; inset: 0; }
.joy { position: absolute; left: 22px; bottom: 26px; width: 136px; height: 136px; border-radius: 50%; background: rgba(246, 236, 214, .35); border: 2px solid rgba(51, 37, 26, .5); pointer-events: auto; }
.joy i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px; border-radius: 50%; background: rgba(246, 236, 214, .9); border: 2px solid var(--ink); }
.tbtn { position: absolute; right: 22px; width: 84px; height: 84px; border-radius: 50%; font-size: 1.1rem; background: rgba(232, 176, 48, .92); border: 2px solid var(--ink); pointer-events: auto; }
.tbtn.act { bottom: 96px; } .tbtn.run { bottom: 96px; right: 118px; width: 68px; height: 68px; background: rgba(246, 236, 214, .9); font-size: .95rem; }
.tbtn.run.on { background: var(--accent); color: #fff; }
@media (pointer: coarse) { .keys { display: none; } }
@media (max-width: 640px) { .tracker { top: 76px; } .menu button { min-width: 54px; min-height: 50px; font-size: .8rem; } .dialogue .text { font-size: 1.12rem; } }
.hud.talking .menu, .hud.talking .keys, .hud.talking .prompt, .hud.talking .touch { display: none; }

/* ---- RPG HUD 확장 ---- */
.hud .card { opacity: var(--hud-alpha, 1); }
.place .en { height: 7px; margin-top: 5px; border-radius: 4px; background: rgba(51, 37, 26, .18); overflow: hidden; min-width: 120px; }
.place .en i { display: block; height: 100%; background: #6a9a5a; transition: width .3s; } .place .en i.low { background: var(--accent); }
.mini { position: absolute; right: 14px; top: 62px; padding: 5px 5px 2px; pointer-events: auto; cursor: pointer; text-align: center; line-height: 1; }
.mini canvas { display: block; width: 132px; height: 132px; border-radius: 8px; }
.mini span { font-size: .78rem; opacity: .8; }
.jobhud { top: 226px; }
.jobhud .jb { font-size: .9rem; opacity: .85; margin-top: 2px; }
.bubble { position: absolute; left: 0; top: 0; max-width: 240px; padding: 6px 12px; font-size: .98rem; line-height: 1.35; background: rgba(255, 252, 244, .95); border: 2px solid var(--ink); border-radius: 14px; white-space: normal; pointer-events: none; }
.photobar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; pointer-events: auto !important; }
.photobar span { color: #fff; text-shadow: 0 1px 3px #000; font-size: .9rem; opacity: .85; }
#ui.photo .hud, #ui.photo .toasts { display: none; }
.panel h3 { margin: 16px 0 4px; font-size: .95rem; color: var(--accent); border-bottom: 2px solid var(--line); padding-bottom: 3px; }
.pbar { height: 9px; border-radius: 5px; background: rgba(51, 37, 26, .15); overflow: hidden; margin-top: 6px; }
.pbar i { display: block; height: 100%; background: #6a9a5a; } .pbar.warm i { background: var(--gold); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; text-align: center; font-size: .9rem; }
.stats div { padding: 8px 2px; border: 2px solid var(--line); border-radius: 10px; } .stats b { display: block; font-size: 1.4rem; }
label.set output { min-width: 3.4em; text-align: right; font-size: .9rem; opacity: .8; }
label.set input[type=range] { width: 42%; }
.note.big { font-size: 1.05rem; opacity: .95; line-height: 1.6; }
.title .donate { margin-top: 14px; font-size: .9rem; opacity: .85; }
.title .donate button { font: inherit; margin-left: 6px; padding: 4px 12px; min-height: 34px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .14); color: inherit; cursor: pointer; }
.menu { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 28px); }
@media (max-width: 640px) { .mini { top: 56px; } .mini canvas { width: 92px; height: 92px; } .jobhud { top: 178px; width: 180px; } .keys { display: none; } }
@media (max-height: 520px) { .mini canvas { width: 96px; height: 96px; } .jobhud { top: 186px; } }
/* 분식집 미니게임 */
.bunsik { width: min(680px, 94vw); background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 12px 14px; color: var(--ink); }
.bunsik .top { display: flex; justify-content: space-between; font-size: 1.05rem; margin-bottom: 8px; }
.bunsik .orders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 104px; }
.bunsik .order { border: 2px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 1rem; background: #fffaf0; cursor: pointer; text-align: left; font-family: inherit; color: inherit; min-height: 96px; }
.bunsik .order.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.bunsik .order .who { font-size: .82rem; opacity: .7; } .bunsik .order .want { font-size: 1.5rem; letter-spacing: 2px; min-height: 1.6em; }
.bunsik .order .pat { height: 6px; border-radius: 3px; background: rgba(51, 37, 26, .15); overflow: hidden; margin-top: 4px; } .bunsik .order .pat i { display: block; height: 100%; background: #6a9a5a; }
.bunsik .tray { margin: 8px 0; padding: 6px 10px; border: 2px dashed var(--line); border-radius: 10px; min-height: 2.6em; font-size: 1.4rem; display: flex; align-items: center; gap: 8px; }
.bunsik .tray small { font-size: .85rem; opacity: .7; }
.bunsik .cook { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bunsik .cook button { min-height: 58px; font: inherit; font-size: .95rem; border: 2px solid var(--ink); border-radius: 10px; background: var(--gold); cursor: pointer; }
.bunsik .cook button span { display: block; font-size: 1.4rem; line-height: 1.1; }
.bunsik .cook button.plain { background: #fffaf0; }
.bunsik .panbar { height: 12px; border: 2px solid var(--ink); border-radius: 7px; overflow: hidden; margin-top: 8px; background: #fff8; }
.bunsik .panbar i { display: block; height: 100%; background: #c8402f; } .bunsik .panbar i.hot { background: #3a2a24; }
.bunsik .hint { font-size: .85rem; opacity: .75; margin-top: 4px; }

/* 인생: 나이 표시, 출생 선택 */
.place em { display: block; font-style: normal; font-size: .92rem; color: #8a4a2a; font-weight: 700; }
.hud.has-life .tracker { top: 106px; }
@media (max-width: 640px) { .hud.has-life .tracker { top: 98px; } }
.title.birth .btns { margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.title.birth .years button { min-width: 0; padding: 8px 12px; font-size: .95rem; }
.title.birth .years button small { display: block; font-size: .72rem; opacity: .7; }
.title.birth button:disabled { opacity: .45; cursor: default; }
.mem small { display: block; margin-top: 4px; opacity: .65; font-size: .82rem; }
/* 출생 선택 화면은 낮은 화면(가로로 든 휴대전화, 작은 창)에서도 '기차역으로' 단추까지 다 보여야 한다 */
.title { overflow-y: auto; }
.title.birth > div { padding: 14px 10px; max-width: 640px; }
.title.birth p { margin-bottom: 12px; }
.title.birth .btns.pick, .title.birth .btns.years { flex-direction: row; gap: 8px; }
.title.birth .btns.pick .big-btn { width: 126px; }
.title.birth .btns.years .big-btn { width: auto; }
.title.birth small { margin-top: 12px; }

/* 출생연도 묻기 */
.title.birth .btns.years { align-items: center; }
.title.birth input.yr { width: 220px; text-align: center; }
.title.birth .btns.years span { font-size: 1.05rem; opacity: .85; }
.title.birth .note-year { margin: 12px auto 0; max-width: 560px; font-size: .86rem; line-height: 1.55; opacity: .9; min-height: 2.6em; }
.title.birth .note-year.warn { color: #ffd27a; opacity: 1; }
