/* 방구석 출국 — 세로 폰 화면 먼저. 색은 테마마다 몇 개만. */
:root {
  --accent: #7fb2ff;
  --bg: #0d0f18; --fg: #e8ecf6; --muted: #8e96ad; --card: #191c2a; --line: #2a2f45;
  --btn: #262a3d; --btnfg: #e8ecf6; --pri: var(--accent); --prifg: #0d0f18;
  --outer: #06070b;
}
body.th-title, body.th-dark, body.th-ending { --bg: #0d0f18; --fg: #e8ecf6; --muted: #8e96ad; --card: #171a27; --line: #2a2f45; --btn: #242838; --btnfg: #e8ecf6; }
body.th-night { --bg: #0f111a; --fg: #e3e7f2; --muted: #8890a8; --card: #1a1d2c; --line: #2c3148; --btn: #252a3e; --btnfg: #e3e7f2; }
body.th-dawn, body.th-dawn2 { --bg: #f1e7e3; --fg: #2a2436; --muted: #7b7088; --card: #fff8f3; --line: #e3d3cc; --btn: #e6d9d6; --btnfg: #2a2436; --prifg: #1b1e2c; --outer: #3a3446; }
body.th-day { --bg: #f5f7fa; --fg: #1b2230; --muted: #66728a; --card: #ffffff; --line: #d6dee8; --btn: #e4eaf2; --btnfg: #1b2230; --pri: #2f6fde; --prifg: #fff; --outer: #c9d3df; }
body.th-arrive { --bg: #f8f3ea; --fg: #2b2620; --muted: #7f7466; --card: #fffdf8; --line: #e6dccb; --btn: #ede3d2; --btnfg: #2b2620; --pri: #b8312f; --prifg: #fff; --outer: #d8ccb8; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--outer);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background .4s;
}
.app {
  position: relative; max-width: 430px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; background: var(--bg); overflow: hidden;
  transition: background .4s;
}
#stage { flex: 1; overflow-y: auto; overflow-x: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.muted { color: var(--muted); }
code { font-size: 12px; background: var(--btn); padding: 1px 4px; border-radius: 4px; }

/* HUD */
#hud {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center;
  padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); font-size: 13px;
}
.h-clock { display: flex; flex-direction: column; line-height: 1.1; }
.h-clock b { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.h-day { font-size: 10px; color: var(--muted); }
.h-money { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.h-stam { display: flex; align-items: center; gap: 4px; color: #e0525a; }
.h-stam i { width: 38px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: block; }
.h-stam em { display: block; height: 100%; background: #e0525a; }
.h-stam span, .h-batt span { color: var(--fg); font-variant-numeric: tabular-nums; }
.h-batt { display: flex; align-items: center; gap: 3px; }

/* 장면 */
.scene { display: flex; justify-content: center; }
.scene-svg { display: block; width: 100%; height: auto; max-height: 56vh; max-height: 56dvh; }
.scene.room-wrap .scene-svg { max-height: 62dvh; }
.scene.intro .scene-svg { max-height: 62dvh; }
.spot { cursor: pointer; }
.spot:hover rect:first-child { fill-opacity: .06; }
.panel { padding: 14px 16px 22px; }
.panel.dark { background: var(--bg); }
.lines p { margin: 0 0 8px; }
.lines p:last-child { font-weight: 600; }
.lines .ev { display: block; font-weight: 600; color: var(--fg); background: var(--card); border-left: 3px solid #e0a526; padding: 8px 10px; border-radius: 4px; }
.info { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.info span { font-size: 11px; color: var(--muted); margin-right: 4px; }

.btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.btn {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 46px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--btn); color: var(--btnfg); text-align: left; font-weight: 600;
}
.btn small { font-weight: 400; color: var(--muted); font-size: 12px; text-align: right; }
.btn.primary { background: var(--pri); color: var(--prifg); border-color: transparent; }
.btn.primary small { color: inherit; opacity: .8; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: default; }

/* 처음 화면 */
.title-wrap { padding: 0 0 24px; text-align: center; }
.title-art .scene-svg { max-height: 46dvh; margin: 0 auto; }
.title-wrap h1 { margin: 16px 0 0; font-size: 30px; letter-spacing: 2px; }
.title-wrap .sub { margin: 2px 0 8px; color: var(--muted); }
.title-wrap .btns { padding: 0 24px; }
.title-wrap .btn { justify-content: center; }
.seed { font-size: 12px; color: var(--muted); margin-top: 16px; padding: 0 16px; }
.list-wrap { padding: 20px 16px 28px; }
.list-wrap h2 { margin: 0 0 4px; font-size: 20px; }
.note { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.end-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.end-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.end-list li b { margin-right: 6px; }
.end-list li small { display: block; color: var(--muted); }
.end-list li.good { border-color: #3fae6a; }
.end-list li.locked { color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* 캐릭터 고르기 */
.chars { display: flex; flex-direction: column; gap: 10px; }
.char {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px; border-radius: 14px;
  background: var(--card); border: 2px solid var(--line);
}
.char.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.char-pic svg { display: block; border-radius: 10px; }
.char-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.char-txt b { font-size: 17px; }
.char-txt span { font-size: 13px; color: var(--muted); }
.char-txt em { font-style: normal; font-size: 13px; color: var(--c); font-weight: 600; }

/* 모니터 */
.monitor { padding: 18px 12px 24px; background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), #07080d; min-height: 100%; }
.bezel { background: #050609; border-radius: 10px; padding: 10px; box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 35%, transparent); }
.browser { background: #f4f6fa; color: #1b2230; border-radius: 4px; padding: 0 0 10px; overflow: hidden; }
.browser .bar { display: flex; align-items: center; gap: 5px; padding: 8px 10px; background: #dde3ec; font-size: 12px; color: #4a5468; }
.browser .bar i { width: 9px; height: 9px; border-radius: 50%; background: #b5bfcd; display: block; }
.browser .bar span { margin-left: 6px; }
.route { padding: 12px 12px 4px; }
.route b { display: block; font-size: 15px; }
.route small { color: #66728a; }
.budget { margin: 4px 12px 8px; font-size: 13px; color: #2f6fde; font-weight: 600; }
.flight {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 8px;
  width: calc(100% - 20px); margin: 8px 10px 0; padding: 10px 12px; text-align: left;
  background: #fff; border: 1px solid #d6dee8; border-radius: 8px; color: #1b2230;
}
.flight:hover { border-color: #2f6fde; }
.f-time b { font-size: 18px; }
.f-time small { color: #66728a; margin-left: 4px; font-size: 11px; }
.f-air { grid-column: 1; font-size: 12px; color: #4a5468; }
.f-air em { font-style: normal; color: #d9603b; }
.f-air small { display: block; color: #66728a; }
.f-price { grid-column: 2; grid-row: 1 / 3; align-self: center; font-weight: 700; font-size: 16px; color: #1b2230; }
.desk-edge { margin: 14px -12px 0; }
.desk-svg { display: block; width: 100%; height: auto; }
.close-link { display: block; margin: 18px auto 0; background: none; border: 0; color: #8e96ad; text-decoration: underline; font-size: 14px; }

/* 컷 */
.cut { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 40px 28px; gap: 6px; }
.cut p { margin: 0 0 8px; font-size: 16px; }
.cut .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cut.sleep { text-align: center; }
.zzz { color: var(--accent); margin: 10px 0; }

/* 방 */
.room-screen { display: flex; flex-direction: column; min-height: 100%; }
.say { flex: 1; min-height: 52px; padding: 10px 16px; font-size: 14px; background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.room-bar { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 12px; }
.rb {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--btn); color: var(--btnfg); font-size: 13px; font-weight: 600;
}
.rb.go { background: var(--pri); color: var(--prifg); border-color: transparent; }
.rb.phone-btn { flex: 0 0 auto; background: transparent; border: 0; padding: 0; }
.th-night .rb .ic, .th-dark .rb .ic { filter: brightness(1.1); }

/* 시트 */
#sheet { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.sheet-card {
  position: relative; background: var(--card); color: var(--fg); border-radius: 18px 18px 0 0;
  padding: 18px 16px 22px; max-height: 82%; overflow-y: auto; animation: up .18s ease-out;
}
.sheet-card h3 { margin: 0 0 6px; font-size: 18px; }
.sheet-card p { margin: 0 0 8px; }
.clue { background: #f2d65a; color: #3a3210; padding: 8px 10px; border-radius: 4px; transform: rotate(-.6deg); font-size: 14px; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.tiles.small { grid-template-columns: repeat(4, 1fr); }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--btn); color: var(--btnfg); font-size: 12px; text-align: center; line-height: 1.25;
}
.item-head { display: flex; gap: 12px; align-items: flex-start; }
.item-head h3 { margin-top: 2px; }
.bagrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.bagbtn {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px; text-align: left;
  border-radius: 12px; border: 1px solid var(--line); background: var(--btn); color: var(--btnfg);
}
.bagbtn span { display: flex; flex-direction: column; line-height: 1.2; }
.bagbtn small { color: var(--muted); font-size: 11px; }
.bagbtn.on { border: 2px solid var(--accent); }
.bagbtn:disabled { opacity: .45; cursor: default; }
.bagbtn.on:disabled { opacity: 1; }
.bagsec { margin: 10px 0; }
.bagsec-h { display: flex; align-items: center; gap: 8px; }
.bagsec-h small { color: var(--muted); }

/* 폰 */
#phone { position: absolute; inset: 0; z-index: 30; display: flex; justify-content: center; align-items: flex-end; }
.ph-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.ph-body { position: relative; width: 86%; max-width: 340px; height: 90%; animation: lift .22s ease-out; }
@keyframes lift { from { transform: translateY(60%); } to { transform: none; } }
.ph-screen {
  position: absolute; inset: 0 0 40px 0; background: #10131c; border: 8px solid #050608; border-radius: 30px;
  color: #e8ecf6; display: flex; flex-direction: column; overflow: hidden; z-index: 1;
}
.ph-hand {
  position: absolute; left: -16px; width: 46%; bottom: -14px; height: 54px; z-index: 2; pointer-events: none;
  background: var(--hand); border-radius: 30px 46px 0 0;
}
.ph-hand::after { content: ''; position: absolute; left: -6px; bottom: 0; width: 46%; height: 30px; background: var(--sleeve); border-radius: 8px 8px 0 0; }
.ph-fingers {
  position: absolute; right: -12px; bottom: 96px; width: 22px; height: 30px; z-index: 2; pointer-events: none;
  border-radius: 12px; background: var(--hand); box-shadow: 0 36px 0 var(--hand), 0 -36px 0 var(--hand);
}
.ph-status { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px 4px; font-size: 12px; }
.ph-content { flex: 1; overflow-y: auto; padding: 6px 12px 12px; font-size: 14px; }
.ph-down { margin: 0 12px 12px; padding: 10px; border-radius: 12px; border: 0; background: #252a3d; color: #e8ecf6; font-weight: 600; }
.ph-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; margin-top: 10px; }
.papp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; color: #e8ecf6; font-size: 11px; }
.app-ic { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.a-mail { background: #3b6fd8; } .a-msg { background: #3fae6a; } .a-news { background: #e0525a; }
.a-pay { background: #2f86d6; } .a-esim { background: #8a6bd1; } .a-alarm { background: #d65a3b; } .papp .a-shorts { background: #2a2e45; }
.papp .dot { position: absolute; top: -2px; right: 8px; width: 12px; height: 12px; border-radius: 50%; background: #57d68d; border: 2px solid #10131c; }
.ph-noti { display: flex; flex-direction: column; gap: 6px; }
.noti { background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 8px 10px; font-size: 13px; }
.noti b { display: block; font-size: 11px; color: #a9b2c9; }
.noti.warn { background: rgba(224, 82, 90, .25); margin-top: 6px; }
.ph-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ic-btn { background: none; border: 0; color: #e8ecf6; padding: 4px; display: flex; }
.row { display: block; width: 100%; text-align: left; background: rgba(255, 255, 255, .06); border: 0; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; color: #e8ecf6; }
.row b { display: block; font-size: 12px; color: #a9b2c9; }
.mail h4 { margin: 0 0 8px; font-size: 14px; }
.mail p { margin: 0 0 6px; font-size: 13px; padding-left: 8px; border-left: 2px solid #3b6fd8; }
.chat { margin-bottom: 12px; }
.chat b { font-size: 12px; color: #a9b2c9; }
.bubble { background: #252a3d; border-radius: 12px 12px 12px 2px; padding: 6px 10px; margin: 4px 0; width: fit-content; max-width: 90%; }
.news p { margin: 0; padding: 8px 0; border-bottom: 1px solid #252a3d; font-size: 13px; }
.task p { margin: 0 0 10px; }
.task .btn { width: 100%; }
.pad { padding: 0 2px; }
.alarm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chip { padding: 10px 0; border-radius: 10px; border: 1px solid #2c3148; background: #1c2030; color: #e8ecf6; font-variant-numeric: tabular-nums; }
.chip.on { background: #d65a3b; border-color: #d65a3b; }
.ph-dead { text-align: center; padding-top: 60px; }

/* 이동 */
.map-wrap { background: #e9eef2; }
.trs { display: flex; flex-direction: column; gap: 10px; }
.tr {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
.tr span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.tr small { color: var(--muted); font-size: 12px; }
.tr-r { text-align: right; }

/* 결과 · 엔딩 */
.result p { margin: 0 0 8px; }
.end-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-weight: 700; margin: 4px 0 12px; }
.end-badge.good { background: #3fae6a; color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-align: center; }
.stats small { display: block; font-size: 10px; color: var(--muted); }
.stats b { font-size: 14px; font-variant-numeric: tabular-nums; }
.result h3 { margin: 16px 0 6px; font-size: 16px; }
.fc { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.fc li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.fc li .ic { margin-top: 2px; }
details { margin: 14px 0 8px; }
summary { cursor: pointer; color: var(--muted); }
.logl { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; }
.logl b { font-variant-numeric: tabular-nums; margin-right: 6px; }
.ending { padding: 28px 20px; text-align: center; }
.ending-art { width: 100%; max-width: 300px; border-radius: 12px; }
.end-no { margin: 14px 0 0; color: var(--accent); font-weight: 700; letter-spacing: 1px; }
.ending h2 { margin: 2px 0 10px; font-size: 24px; }
.ending .btn { justify-content: center; }

/* 수하물 작은 글씨 · 돈 빠져나감 */
.f-bag { color: #2f6fde !important; font-weight: 600; }
.fine { display: block; font-size: 10.5px !important; color: #8a93a6 !important; line-height: 1.3; }
.sheet-card .fine, .task .fine { font-size: 11px !important; }
.warn { color: #e0525a; font-weight: 700; }
.h-money { position: relative; }
.money-pop {
  position: absolute; right: 0; top: 100%; font-size: 13px; font-weight: 700; color: #e0525a;
  background: var(--card); padding: 1px 6px; border-radius: 6px; animation: pop 1.6s ease-out forwards; pointer-events: none; white-space: nowrap;
}
.money-pop.plus { color: #3fae6a; }
@keyframes pop { 0% { opacity: 0; transform: translateY(-6px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }

/* 방: 기본 세로 화면 — 장면(3:4) · 설명 칸 · 가방 줄 · 할 일 (스크롤 없이) */
.room-screen { height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 10px; }
.frame { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; }
.frame .scene-svg.room { height: 100%; width: auto; max-width: 100%; max-height: none; aspect-ratio: 3 / 4; border-radius: 12px; border: 1px solid var(--line); }
.spot.item:hover { filter: brightness(1.25); }
.sel-box { filter: drop-shadow(0 0 4px rgba(255, 200, 120, .7)); }
.desc {
  flex: 0 0 auto; height: 172px; overflow-y: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; font-size: 14px;
}
.desc h2 { margin: 0; font-size: 15px; color: var(--accent); }
.th-dawn .desc h2 { color: #b85a1e; }
.desc h2 small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.desc p { margin: 0; line-height: 1.5; }
.desc .clue { margin: 2px 0; }
.d-note { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 6px; }
.d-hint { font-size: 12.5px; color: var(--muted); margin-top: auto !important; }
.d-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.dbtn {
  padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--btn); color: var(--btnfg);
  font-size: 13px; font-weight: 600;
}
.dbtn small { font-weight: 400; color: var(--muted); }
.dbtn:disabled { opacity: .45; cursor: default; }
.dbtn.here { border-style: dashed; color: var(--muted); font-weight: 400; background: transparent; }
.dbtn.ghost { background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip2 { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px 4px 5px; border-radius: 14px; border: 1px solid var(--line); background: var(--btn); color: var(--btnfg); font-size: 12.5px; }
.bagrow2 { flex: 0 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.bagcell {
  display: flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 12px; min-width: 0;
}
.bagcell span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bagcell b { color: var(--fg); font-size: 15px; font-variant-numeric: tabular-nums; }
.bagcell.on { border-color: var(--accent); }
.room-acts { flex: 0 0 auto; display: flex; gap: 6px; }
.ra {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--btn); color: var(--btnfg); font-size: 14px; font-weight: 700;
}
.ra.go { background: var(--pri); color: var(--prifg); border-color: transparent; }
.ra-dot { position: absolute; top: 6px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #e0525a; }
