* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #000; overflow: hidden; overscroll-behavior: none; }
/* 한글 단어가 줄 끝에서 잘리지 않게 */
body { word-break: keep-all; overflow-wrap: break-word; }
body { display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
body { font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }

#app {
  --fg: #e8e6df; --panel: rgba(20,20,28,.92); --line: rgba(255,255,255,.18); --accent: #ffd76a;
  position: relative; width: 100%; max-width: 480px; height: 100vh; height: 100dvh; --cs: 50px; --ts: 70px;
  color: var(--fg); background: #050508; overflow: hidden;
  transition: background 1.5s, color 1.5s; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
#app.mood-dark   { background: #050508; }
#app.mood-phone  { background: radial-gradient(circle at 50% 38%, #24324d 0, #0a0d16 55%, #050508 100%); }
#app.mood-candle { background: radial-gradient(circle at 50% 40%, #5a3a12 0, #1c1206 50%, #060403 100%); }
#app.mood-room   { background: #f3ead2; --fg: #2a2620; --panel: rgba(255,255,255,.92); --line: rgba(0,0,0,.15); --accent: #c77700; }
#app.mood-store  { background: #e9eef2; --fg: #20262b; --panel: rgba(255,255,255,.95); --line: rgba(0,0,0,.15); --accent: #0b74c4; }
#app.mood-light  { background: radial-gradient(circle at 50% 30%, #fffdf2 0, #ffeeb0 70%, #ffdf80 100%); --fg: #2a2620; --panel: rgba(255,255,255,.92); --line: rgba(0,0,0,.15); --accent: #c77700; }

#stage { position: absolute; inset: 0; }

/* ---------- 공통 UI ---------- */
button {
  font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; cursor: pointer;
}
button:active { transform: scale(.97); }
.btn-main { border-color: var(--accent); color: var(--accent); font-weight: 700; }

#dlg {
  position: absolute; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); min-height: 108px; padding: 14px 16px 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; font-size: 17px; line-height: 1.55; cursor: pointer; z-index: 20;
}
#dlg .who { font-size: 13px; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
#dlg .who:empty { display: none; }
#dlg .next { position: absolute; right: 14px; bottom: 6px; font-size: 11px; opacity: .6; animation: bob 1s infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

#choices { position: absolute; left: 12px; right: 12px; bottom: calc(136px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 21; }
#choices[hidden], #dlg[hidden], #toast[hidden] { display: none; }
#choices button { text-align: left; font-size: 16px; }

#toast {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); max-width: 88%; width: max-content; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 14px; z-index: 30;
}

.hud {
  position: absolute; top: 0; left: 0; right: 0; padding: 14px 12px; font-size: 14px; text-align: center;
  background: linear-gradient(var(--panel), transparent); z-index: 10; pointer-events: none;
}

/* ---------- 스토리 장면 ---------- */
.scene { position: absolute; inset: 0 0 140px 0; display: flex; align-items: center; justify-content: center; font-size: 110px; }
.scene .art { transition: opacity .6s, filter .6s; }
.scene.flicker .art { animation: flicker .5s steps(2) infinite; }
.scene.dim .art { opacity: .35; filter: grayscale(.6); }
.scene.glow .art { filter: drop-shadow(0 0 40px #ffd76a); }
@keyframes flicker { 50% { opacity: .15; } }

.daycard { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; animation: fadein .6s; }
.daycard .d { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.daycard .t { font-size: 17px; opacity: .75; }
@keyframes fadein { from { opacity: 0; } }

.title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.title h1 { font-size: 40px; letter-spacing: 2px; text-shadow: 0 0 24px rgba(255,215,106,.55); }
.title p { opacity: .7; font-size: 15px; }
.title .bulb { font-size: 70px; animation: flicker 2.4s steps(2) infinite; }
.title button { margin-top: 24px; font-size: 18px; padding: 14px 34px; }

.ending { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; animation: fadein 1.5s; }
.ending h2 { font-size: 30px; }
.ending ul { list-style: none; font-size: 16px; line-height: 2; }
.ending .bulb { font-size: 84px; filter: drop-shadow(0 0 40px #ffb300); }

/* ---------- 미니게임 1: 더듬더듬 찾기 ---------- */
.mini-search { cursor: none; touch-action: none; }
.mini-search .item { position: absolute; font-size: 38px; transform: translate(-50%, -50%); cursor: pointer; padding: 6px; }
.mini-search .item.found { opacity: 0; pointer-events: none; transition: opacity .4s; }
.mini-search .dark {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle var(--r, 78px) at var(--x, 50%) var(--y, 50%), rgba(0,0,0,0) 0, rgba(0,0,0,.6) 60%, rgba(2,2,4,.985) 100%);
}

/* ---------- 미니게임 2: 어둠 속 라면 ---------- */
.mini-cook { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 24px; height: 100%; }
.mini-cook .pot { font-size: 90px; }
.mini-cook .label { font-size: 18px; text-align: center; min-height: 54px; }
.mini-cook .bar { position: relative; width: 100%; height: 34px; border-radius: 17px; background: rgba(255,255,255,.1); border: 1px solid var(--line); overflow: hidden; }
.mini-cook .zone { position: absolute; top: 0; bottom: 0; background: rgba(110,220,130,.55); }
.mini-cook .marker { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #fff; border-radius: 3px; box-shadow: 0 0 10px #fff; }
.mini-cook button { font-size: 20px; padding: 16px 48px; }

/* ---------- 미니게임 3: 암흑 보행 ---------- */
.mini-walk { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; height: 100%; padding-top: 40px; touch-action: none; }
.mini-walk .grid { display: grid; gap: 3px; }
.mini-walk .cell { width: var(--cs); height: var(--cs); border-radius: 8px; background: rgba(255,255,255,.07); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.mini-walk .cell span { transition: opacity .4s; }
.mini-walk.dark .cell.ob:not(.hit) span { opacity: 0; }
.mini-walk.dark .cell { background: rgba(255,255,255,.03); }
.mini-walk .cell.hit { background: rgba(255,80,80,.25); }
.mini-walk .pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 50px); gap: 6px; }
.mini-walk .pad button { padding: 0; font-size: 20px; }
.mini-walk .pad .u { grid-column: 2; grid-row: 1; } .mini-walk .pad .l { grid-column: 1; grid-row: 2; }
.mini-walk .pad .d { grid-column: 2; grid-row: 2; } .mini-walk .pad .r { grid-column: 3; grid-row: 2; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- 미니게임 4: 전등 고르기 ---------- */
.mini-shop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 100%; padding: 60px 18px 18px; }
.mini-shop .memo { background: #fff7b8; color: #333; padding: 22px 26px; border-radius: 4px; font-size: 19px; line-height: 1.9; transform: rotate(-2deg); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.mini-shop .memo b { display: block; font-size: 14px; opacity: .6; }
.mini-shop .shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.mini-shop .prod { text-align: center; font-size: 14px; line-height: 1.6; padding: 14px 8px; }
.mini-shop .prod .ico { font-size: 34px; display: block; }
.mini-shop .prod .price { opacity: .6; font-size: 13px; }

/* ---------- 미니게임 5: 배선 연결 ---------- */
.mini-wires { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; padding-top: 40px; }
.mini-wires .grid { display: grid; grid-template-columns: repeat(4, var(--ts)); gap: 4px; }
.mini-wires .tile { position: relative; width: var(--ts); height: var(--ts); border-radius: 10px; background: rgba(255,255,255,.07); cursor: pointer; }
.mini-wires .tile.fixed { cursor: default; background: rgba(255,255,255,.14); }
.mini-wires .rot { position: absolute; inset: 0; transition: transform .18s; }
.mini-wires .arm { position: absolute; background: #6b7280; transition: background .2s; }
.mini-wires .arm.n { left: calc(50% - 5px); top: 0; width: 10px; height: 50%; }
.mini-wires .arm.s { left: calc(50% - 5px); bottom: 0; width: 10px; height: 50%; }
.mini-wires .arm.e { top: calc(50% - 5px); right: 0; height: 10px; width: 50%; }
.mini-wires .arm.w { top: calc(50% - 5px); left: 0; height: 10px; width: 50%; }
.mini-wires .arm.c { left: calc(50% - 5px); top: calc(50% - 5px); width: 10px; height: 10px; border-radius: 2px; }
.mini-wires .tile.on .arm { background: #ffd23f; box-shadow: 0 0 8px #ffd23f; }
.mini-wires .ico { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; z-index: 2; }
.mini-wires.solved .tile { pointer-events: none; }

/* ---------- 반응형: PC / 모바일 ---------- */
/* PC·태블릿: 화면 가운데에 휴대폰 크기 프레임으로 표시 */
@media (min-width: 520px) and (min-height: 640px) {
  body { background: radial-gradient(circle at 50% 30%, #17171f 0, #000 70%); }
  #app { height: min(calc(100dvh - 32px), 860px); border-radius: 22px; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
}
/* 마우스가 있는 기기에서만 hover 효과 */
@media (hover: hover) {
  button:hover { border-color: var(--accent); }
  .mini-wires .tile:not(.fixed):hover { background: rgba(255,255,255,.13); }
}
/* 세로가 짧은 화면 (작은 폰) */
@media (max-height: 640px) {
  #app { --cs: 42px; --ts: 62px; }
  .scene { font-size: 84px; }
  .mini-walk { gap: 10px; }
  .mini-walk .pad { grid-template-rows: repeat(2, 44px); }
  .mini-cook { gap: 16px; } .mini-cook .pot { font-size: 64px; }
  .title h1 { font-size: 34px; }
}
/* 가로가 좁은 화면 */
@media (max-width: 350px) {
  #app { --cs: 44px; --ts: 64px; }
  #dlg { font-size: 16px; }
}
/* 폰을 가로로 눕혔을 때 안내 */
#rotate { display: none; }
@media (orientation: landscape) and (max-height: 480px) {
  #rotate { display: flex; position: fixed; inset: 0; z-index: 100; background: #050508; color: #e8e6df; align-items: center; justify-content: center; font-size: 18px; text-align: center; padding: 24px; }
}

/* ---------- 미니게임: 가평 가는 길 (운전) ---------- */
.mini-drive { touch-action: none; }
.mini-drive .road { position: absolute; inset: 0 8%; background: #3a3d44; overflow: hidden; }
.mini-drive .lane-line { position: absolute; top: -40px; bottom: 0; width: 4px; margin-left: -2px;
  background: repeating-linear-gradient(#fff 0 22px, transparent 22px 40px); opacity: .7; animation: roadmove .35s linear infinite; }
.mini-drive .l1 { left: 33.33%; } .mini-drive .l2 { left: 66.66%; }
@keyframes roadmove { to { transform: translateY(40px); } }
.mini-drive .car, .mini-drive .ob { position: absolute; font-size: 46px; transform: translate(-50%, -50%); }
.mini-drive .car { top: 82%; transition: left .12s; z-index: 2; }
.mini-drive .car.hit { animation: flicker .2s steps(2) 4; }
.mini-drive .zones { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: space-between; padding: 0 16px; font-size: 26px; opacity: .55; pointer-events: none; z-index: 3; }

/* ---------- 미니게임: 팔씨름 ---------- */
.mini-arm { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; height: 100%; padding: 24px; touch-action: none; }
.mini-arm .vs { font-size: 64px; display: flex; gap: 18px; align-items: center; }
.mini-arm .arm-emoji { transition: transform .1s; display: inline-block; }
.mini-arm .bar { position: relative; width: 100%; height: 30px; border-radius: 15px; background: #c2473d; border: 1px solid var(--line); overflow: hidden; }
.mini-arm .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #3d8bc2; }
.mini-arm .names { display: flex; justify-content: space-between; width: 100%; font-size: 14px; }
.mini-arm .big { font-size: 22px; font-weight: 800; min-height: 32px; }

/* ---------- 미니게임: 병뚜껑 멀리치기 ---------- */
.mini-cap { touch-action: none; }
.mini-cap .table { position: absolute; left: 24%; right: 24%; top: 13%; bottom: 25%; background: #9a6b3f; border-radius: 6px; box-shadow: inset 0 0 0 4px #7d5530; }
.mini-cap .rec { position: absolute; left: 0; right: 0; height: 2px; background: #fff; opacity: .8; }
.mini-cap .rec span { position: absolute; right: 4px; bottom: 3px; font-size: 11px; color: #fff; white-space: nowrap; }
.mini-cap .cap { position: absolute; left: 50%; bottom: 0; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe680, #c79a00); border: 2px dashed #8a6a00; }
.mini-cap .cap.fly { transition: bottom 1.1s cubic-bezier(.1,.7,.2,1), opacity .3s 1s; }
.mini-cap .gauge { position: absolute; right: 7%; top: 13%; bottom: 25%; width: 16px; border-radius: 8px; background: rgba(128,128,128,.3); border: 1px solid var(--line); overflow: hidden; }
.mini-cap .gauge .danger { position: absolute; left: 0; right: 0; top: 0; height: 16.7%; background: rgba(230,60,60,.6); }
.mini-cap .gauge .lv { position: absolute; left: 0; right: 0; bottom: 0; background: #6ad36a; }
.mini-cap .info { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font-size: 17px; line-height: 1.6; }

/* ---------- 미니게임: 농구 ---------- */
.mini-hoop { touch-action: none; }
.mini-hoop .court { position: absolute; inset: 0; }
.mini-hoop .hoop { position: absolute; top: 20%; width: 84px; height: 84px; transform: translate(-50%, -50%); }
.mini-hoop .bb { position: absolute; left: 6px; right: 6px; top: 0; height: 52px; background: #fff; border: 3px solid #333; border-radius: 4px; box-shadow: inset 0 0 0 9px #fff, inset 0 0 0 11px #d33; }
.mini-hoop .rim { position: absolute; left: 18px; right: 18px; top: 46px; height: 9px; border-radius: 5px; background: #f26a1b; }
.mini-hoop .net { position: absolute; left: 24px; right: 24px; top: 55px; height: 26px; border-radius: 0 0 14px 14px; background: repeating-linear-gradient(60deg, transparent 0 5px, rgba(120,120,120,.8) 5px 6px), repeating-linear-gradient(-60deg, transparent 0 5px, rgba(120,120,120,.8) 5px 6px); }
.mini-hoop .ball { position: absolute; left: 50%; bottom: 14%; font-size: 44px; transform: translateX(-50%); }
.mini-hoop .info { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font-size: 17px; }

/* ---------- 미니게임: 윷놀이 ---------- */
.mini-yut { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; padding: 60px 24px 24px; }
.mini-yut .sticks { display: flex; gap: 10px; height: 110px; align-items: center; }
.mini-yut .stick { width: 22px; height: 100px; border-radius: 11px; background: #d9b88a; border: 2px solid #8a6a3a; transition: transform .3s, background .3s; }
.mini-yut .stick.back { background: #6b4a22; }
.mini-yut .res { font-size: 26px; font-weight: 800; min-height: 36px; }
.mini-yut .track { width: 100%; font-size: 14px; }
.mini-yut .track .line { position: relative; height: 16px; border-radius: 8px; background: rgba(128,128,128,.25); margin: 4px 0 12px; overflow: hidden; }
.mini-yut .track .line div { position: absolute; left: 0; top: 0; bottom: 0; transition: width .4s; }
.mini-yut .me div { background: #3d8bc2; } .mini-yut .op div { background: #c2473d; }
.mini-yut button { font-size: 19px; padding: 14px 40px; }
.mini-yut button:disabled { opacity: .4; }

/* ---------- 미니게임: 노래자랑 ---------- */
.mini-song { touch-action: none; }
.mini-song .mic { position: absolute; left: 0; right: 0; top: 20%; text-align: center; font-size: 80px; }
.mini-song .lane { position: absolute; left: 0; right: 0; top: 52%; height: 70px; background: rgba(128,128,128,.15); overflow: hidden; }
.mini-song .target { position: absolute; left: 18%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; border: 3px solid var(--accent); }
.mini-song .target.pulse { background: var(--accent); }
.mini-song .note { position: absolute; top: 50%; font-size: 36px; transform: translate(-50%, -50%); }
.mini-song .note.hit { opacity: 0; transition: opacity .15s; }
.mini-song .info { position: absolute; left: 0; right: 0; top: 70%; text-align: center; font-size: 18px; }

/* ---------- 미니게임: 짝 맞추기 ---------- */
.mini-memory { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding-top: 40px; }
.mini-memory .grid { display: grid; grid-template-columns: repeat(3, calc(var(--ts) + 14px)); gap: 8px; }
.mini-memory .card { height: calc(var(--ts) + 14px); border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 36px; cursor: pointer; }
.mini-memory .card .f { opacity: 0; transition: opacity .15s; }
.mini-memory .card.open .f, .mini-memory .card.done .f { opacity: 1; }
.mini-memory .card.done { border-color: var(--accent); }

/* ---------- 따릉이 (운전 게임의 자전거 버전) ---------- */
.mini-drive.bike .road { background: #2f5d3a; inset: 0 14%; }
.mini-drive.bike .lane-line { opacity: .35; }
.mini-drive.bike .car { font-size: 52px; filter: brightness(1.8) drop-shadow(0 0 6px #fff); }
.mini-drive.bike .ob { font-size: 38px; }

/* ---------- 미니게임: 트랙 러닝 ---------- */
.mini-run { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; height: 100%; padding: 60px 24px 24px; touch-action: none; }
.mini-run .runner { font-size: 90px; transform: scaleX(-1); transition: transform .08s; }
.mini-run .dist { font-size: 20px; font-weight: 700; }
.mini-run .track { width: 100%; height: 18px; border-radius: 9px; background: rgba(128,128,128,.25); overflow: hidden; }
.mini-run .track div { height: 100%; width: 0; background: #e2683c; }
.mini-run .feet { display: flex; gap: 12px; width: 100%; }
.mini-run .feet button { flex: 1; font-size: 19px; padding: 22px 0; touch-action: none; }

/* ---------- 미니게임: 오르골 ---------- */
.mini-mbox { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; height: 100%; padding: 60px 20px 20px; touch-action: none; }
.mini-mbox .box { font-size: 84px; transition: transform .15s; }
.mini-mbox .box.on { transform: scale(1.15) rotate(-6deg); }
.mini-mbox .pads { display: flex; gap: 8px; width: 100%; align-items: flex-end; height: 170px; }
.mini-mbox .pad { flex: 1; border-radius: 8px 8px 14px 14px; border: 2px solid rgba(0,0,0,.25); padding: 0; touch-action: none; }
.mini-mbox .pad:nth-child(1) { height: 100%; background: #c9a227; } .mini-mbox .pad:nth-child(2) { height: 90%; background: #d0ab35; }
.mini-mbox .pad:nth-child(3) { height: 80%; background: #d8b545; } .mini-mbox .pad:nth-child(4) { height: 70%; background: #e0c058; }
.mini-mbox .pad:nth-child(5) { height: 60%; background: #e8cb6c; }
.mini-mbox .pad.on { background: #fff; box-shadow: 0 0 18px #ffe9a0; transform: translateY(4px); }
.mini-mbox .info { font-size: 16px; }

/* ---------- 타이틀 기록 / 크레딧 ---------- */
.title .rec { font-size: 13px; opacity: .6; margin-top: 6px; }
.ending .btns { display: flex; gap: 8px; margin-top: 6px; }
.credits { position: absolute; inset: 0; overflow: hidden; }
.credits .roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; padding: 0 24px; animation: roll 38s linear forwards; }
@keyframes roll { to { transform: translateY(calc(-100% - 100vh)); } }
.credits h3 { font-size: 13px; opacity: .55; font-weight: 500; margin: 34px 0 8px; letter-spacing: 2px; }
.credits p { font-size: 17px; line-height: 1.9; }
.credits .big { font-size: 30px; font-weight: 800; margin: 20px 0; }
.credits .fin { margin: 80px 0 40px; font-size: 20px; }
.credits button { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); font-size: 14px; padding: 8px 18px; opacity: .8; z-index: 2; }

/* 실화 강조 */
.true-badge { font-size: 12px; letter-spacing: 3px; padding: 4px 12px; border: 1px solid rgba(255,215,106,.7); color: #ffd76a; border-radius: 3px; }
.truth { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 28px; background: #000; color: #fff; }
.truth p { word-break: keep-all; animation: fadein 1s backwards; }
.truth .l1 { font-size: 16px; }
.truth .l2 { font-size: 28px; font-weight: 800; line-height: 1.4; color: #ffd76a; animation-delay: .6s; }
.truth .l3 { font-size: 14px; line-height: 1.8; animation-delay: 1.6s; }
.truth .l4 { font-size: 12px; margin-top: 20px; animation-delay: 2.4s; }
.true-note { font-size: 13px; color: #ffd76a; }
.credits .true-end { margin: 60px 0 12px; font-size: 20px; line-height: 1.7; }
.credits .true-end b { color: #ffd76a; font-size: 26px; }

/* 빛의 조각 */
#shards { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; z-index: 25; font-size: 13px; color: #ffd76a; background: rgba(0,0,0,.45); border-radius: 999px; padding: 3px 9px; pointer-events: none; }
#shards[hidden] { display: none; }
.shard-get { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; background: rgba(0,0,0,.72); animation: fadein .5s; }
.shard-get .s { font-size: 64px; filter: drop-shadow(0 0 24px #ffd76a); animation: shardpop .9s ease-out; }
.shard-get .l { font-size: 14px; opacity: .7; color: #fff; }
.shard-get .n { font-size: 22px; font-weight: 700; color: #ffd76a; }
.shard-get .c { font-size: 13px; opacity: .6; color: #fff; }
@keyframes shardpop { from { transform: scale(.2) rotate(-40deg); opacity: 0; } }
.afterglow { position: absolute; inset: 0; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; }
.afterglow .bin { font-size: 64px; filter: brightness(.25); transition: filter 5s; }
.afterglow.lit .bin { filter: brightness(.6) drop-shadow(0 0 26px rgba(255,215,106,.9)); }
.afterglow .names { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; max-width: 320px; min-height: 120px; align-content: flex-start; }
.afterglow .names span { font-size: 13px; color: #ffd76a; animation: fadein 1.6s; opacity: .8; text-shadow: 0 0 10px rgba(255,215,106,.7); }

/* 소리 버튼 */
#mute { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; z-index: 26; width: 32px; height: 32px; padding: 0; font-size: 15px; border-radius: 50%; background: rgba(0,0,0,.45); border: 0; opacity: .75; }

/* ============================================================
   디자인: 손전등(검정 + 전구빛 노랑, 명조체, 상자 없는 대사) + 폰 화면(메신저·쇼핑)
   ============================================================ */
body { font-family: "IBM Plex Sans KR", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
#app { --serif: "Hahmlet", "Noto Serif KR", "Nanum Myeongjo", "Batang", serif; --bgc: #000; --spot: rgba(255,214,110,.13); --fg: #e9e4d6; --panel: rgba(0,0,0,.6); --line: rgba(233,228,214,.28); --accent: #ffd66e; }
#app.mood-dark   { background: #000; }
#app.mood-phone  { background: #03050a; --bgc: #03050a; --spot: rgba(150,180,255,.2); }
#app.mood-candle { background: #050300; --bgc: #050300; --spot: rgba(255,170,60,.25); }
#app.mood-room   { background: #efe7d2; --bgc: #efe7d2; --spot: transparent; --fg: #24211b; --panel: rgba(255,255,255,.6); --line: rgba(36,33,27,.3); --accent: #9a6400; }
#app.mood-store  { background: #e8ecee; --bgc: #e8ecee; --spot: transparent; --fg: #1d2226; --panel: rgba(255,255,255,.7); --line: rgba(29,34,38,.3); --accent: #9a6400; }
#app.mood-light  { background: radial-gradient(circle at 50% 32%, #fffdf2 0, #fff0b8 60%, #f4dc8a 100%); --bgc: #f8e7a4; --spot: transparent; --fg: #24211b; --panel: rgba(255,255,255,.6); --line: rgba(36,33,27,.3); --accent: #9a6400; }

button { border-radius: 3px; background: transparent; }
.btn-main { letter-spacing: .08em; }
#toast { border-radius: 3px; background: var(--bgc); }
.hud { background: linear-gradient(var(--bgc) 55%, transparent); font-size: 13px; letter-spacing: .04em; padding-left: 48px; padding-right: 48px; }

/* 대사: 상자 없이 소설처럼 */
#dlg { left: 0; right: 0; bottom: 0; padding: 34px 26px calc(34px + env(safe-area-inset-bottom, 0px)); min-height: 150px; border: 0; border-radius: 0;
  background: linear-gradient(transparent, var(--bgc) 26px); font-family: var(--serif); font-size: 17px; line-height: 1.8; }
#dlg .who { font-family: "IBM Plex Sans KR", sans-serif; font-size: 12px; letter-spacing: .2em; margin-bottom: 4px; }
#dlg .next { right: 26px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
#choices { left: 26px; right: 26px; bottom: calc(160px + env(safe-area-inset-bottom, 0px)); gap: 0; }
#choices button { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 13px 2px; background: var(--bgc); font-family: var(--serif); }
#choices button:last-child { border-bottom: 1px solid var(--line); }

/* 장면: 빛이 닿는 동그라미 안에 그림 하나 */
.scene { inset: 0 0 170px 0; font-size: 92px; }
.scene::before { content: ""; position: absolute; left: 50%; top: 50%; width: 320px; height: 320px; margin: -160px; border-radius: 50%; background: radial-gradient(circle, var(--spot) 0, transparent 68%); pointer-events: none; }
.scene .art { position: relative; }
.mood-dark .scene .art, .mood-phone .scene .art, .mood-candle .scene .art { filter: grayscale(1) sepia(1) saturate(1.5) brightness(.85); }
.mood-dark .scene.dim .art, .mood-phone .scene.dim .art { opacity: .4; }
.mood-dark .scene.glow .art, .mood-phone .scene.glow .art { filter: grayscale(1) sepia(1) saturate(2) brightness(1.1) drop-shadow(0 0 34px #ffd66e); }

.daycard { font-family: var(--serif); gap: 16px; padding: 0 26px; text-align: center; }
.daycard .d { font-family: "IBM Plex Sans KR", sans-serif; font-size: 13px; letter-spacing: .25em; opacity: .7; }
.daycard .t { font-size: 24px; font-weight: 700; line-height: 1.5; }
.daycard .t::before { content: ""; display: block; width: 28px; border-top: 1px solid var(--accent); margin: 0 auto 16px; }

.title { gap: 12px; }
.title .bulb { color: #ffe7a8; line-height: 0; filter: drop-shadow(0 0 22px rgba(255,214,110,.75)); position: relative; }
.title h1 { font-family: var(--serif); font-size: 34px; letter-spacing: .1em; text-shadow: none; margin-top: 10px; }
.title p { font-family: var(--serif); font-size: 14px; line-height: 1.8; }
.title button { border: 0; border-bottom: 1px solid var(--accent); padding: 8px 6px; font-family: var(--serif); font-size: 16px; }
.true-badge { border: 0; font-size: 11px; letter-spacing: .3em; padding: 0; }
.ending h2, .ending p { font-family: var(--serif); }
.ending ul { font-size: 15px; }
.credits { font-family: var(--serif); }
.shard-get .n { font-family: var(--serif); }
.afterglow .names span { font-family: var(--serif); }

/* 폰 화면: 메신저 */
#stage.chat { background: #0b0d12; color: #f2f4f8; font-family: "IBM Plex Sans KR", sans-serif; }
.chat .cbar { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 52px; right: 60px; display: flex; justify-content: space-between; font-size: 12px; color: #aeb4c0; }
.chat .cbar b { color: #ff6b5e; font-weight: 500; }
.chat .croom { position: absolute; top: calc(44px + env(safe-area-inset-top, 0px)); left: 0; right: 0; padding: 10px 18px; font-size: 15px; font-weight: 700; border-bottom: 1px solid #1c2029; }
.chat .msgs { position: absolute; top: calc(92px + env(safe-area-inset-top, 0px)); bottom: 46px; left: 0; right: 0; padding: 14px 14px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.chat .b { max-width: 80%; padding: 9px 13px; border-radius: 16px; background: #1c2029; align-self: flex-start; font-size: 15px; line-height: 1.5; animation: fadein .25s; flex: none; }
.chat .b b { display: block; font-size: 11px; color: #aeb4c0; font-weight: 500; }
.chat .b.me { align-self: flex-end; background: #ffd66e; color: #1a1500; }
.chat .sys { align-self: center; text-align: center; font-size: 13px; color: #8d94a1; line-height: 1.6; padding: 4px 10px; max-width: 92%; animation: fadein .25s; flex: none; }
.chat .ctap { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 11px; color: #8d94a1; }
#app.chat-on #choices { left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); gap: 7px; }
#app.chat-on #choices button, #app.chat-on #choices button:last-child { border: 1px solid #3a4050; border-radius: 18px; padding: 10px 14px; background: #0b0d12; color: #f2f4f8; font-family: "IBM Plex Sans KR", sans-serif; font-size: 14px; }
#app.chat-on #mute { background: transparent; }

/* 폰 화면: 쇼핑 앱 */
.mini-shop .appbar { width: 100%; background: #fff; color: #555; border-radius: 6px; padding: 9px 12px; font-size: 14px; }
.mini-shop .prod { background: #fff; color: #16181c; border: 0; border-radius: 6px; }
.mini-shop .prod .price { opacity: 1; color: #c0392b; font-weight: 700; font-size: 15px; }
.title .bulb::before { content: ""; position: absolute; left: 50%; top: 40%; width: 280px; height: 280px; margin: -140px; border-radius: 50%; background: radial-gradient(circle, rgba(255,214,110,.3), rgba(255,214,110,.08) 42%, transparent 68%); }
.title .bulb { animation: flicker 3.2s steps(1) infinite; }
@keyframes titleflick { 0%, 92% { opacity: 1; } 94% { opacity: .3; } 96% { opacity: 1; } 98% { opacity: .5; } }
.title .bulb { animation: titleflick 4s infinite; }

/* 깜짝 */
.scare { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: #fff; animation: scareflash 1s forwards; pointer-events: none; }
.scare span { font-size: 200px; animation: scarepop .25s ease-out; }
@keyframes scareflash { 0%, 12% { background: #fff; } 100% { background: rgba(0,0,0,.85); } }
@keyframes scarepop { from { transform: scale(.2); } }
/* 어둠 속 일상 게임 */
.mini-fridge, .mini-pour, .mini-plug { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; padding: 76px 18px 18px; text-align: center; }
.mini-fridge .info, .mini-pour .info, .mini-plug .info { font-size: 14px; line-height: 1.6; min-height: 46px; opacity: .85; }
.fridge { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; width: min(100%, 300px); transition: background .2s; }
.fridge.lit { background: rgba(190,220,255,.2); box-shadow: 0 0 40px rgba(190,220,255,.25); }
.fridge .cell { aspect-ratio: 1; font-size: 34px; padding: 0; }
.fridge:not(.lit) .cell span { opacity: 0; }
.fridge .cell.ok { border-color: #7bd88f; } .fridge .cell.bad { border-color: #ff6b5e; }
.mini-pour .cup { position: relative; width: 110px; height: 150px; border: 2px solid var(--fg); border-top: 0; border-radius: 0 0 14px 14px; opacity: .08; transition: opacity .5s; overflow: hidden; }
.mini-pour .cup .line { position: absolute; left: 0; right: 0; bottom: 75%; border-top: 1px dashed var(--accent); }
.mini-pour .cup .water { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(120,180,255,.7); }
.mini-pour.reveal .cup { opacity: 1; overflow: visible; }
.mini-pour.over .cup { box-shadow: 0 14px 0 -4px rgba(120,180,255,.6); }
.mini-pour .snd { font-size: 20px; min-height: 30px; letter-spacing: .1em; color: var(--accent); }
.mini-pour button { font-size: 18px; padding: 20px 40px; touch-action: none; }
.mini-plug .phone { width: 150px; height: 70px; border: 2px solid var(--line); border-bottom-width: 2px; border-radius: 16px 16px 0 0; position: relative; opacity: .5; }
.mini-plug .port { position: absolute; left: 50%; bottom: -2px; width: 30px; height: 8px; margin-left: -15px; background: var(--accent); border-radius: 3px 3px 0 0; }
.mini-plug .rail { position: relative; width: 100%; height: 70px; }
.mini-plug .tip { position: absolute; top: 0; left: 8%; font-size: 44px; transform: translateX(-50%) rotate(-45deg); filter: grayscale(1) brightness(.8); }
.mini-plug .tip.flip { transform: translateX(-50%) rotate(-45deg) scaleX(-1); }
.mini-plug.done .phone { opacity: 1; box-shadow: 0 0 50px rgba(150,180,255,.6); }

/* ============================================================
   마감: 눈에 띄지 않게 다듬기 (질감, 여백, 전환, 가는 선)
   ============================================================ */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-variant-numeric: tabular-nums; }
/* 종이·필름 같은 미세한 입자 */
#app::after { content: ""; position: absolute; inset: 0; z-index: 55; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }
/* 맨 위의 가는 진행선: 모은 조각만큼 길어진다 */
#app::before { content: ""; position: absolute; top: 0; left: 0; height: 1px; width: calc(var(--prog, 0) * 100%); background: var(--accent); opacity: .7; z-index: 40; transition: width 1.2s ease; }
#stage > * { animation: fadein .4s ease both; }
.scare, .ghost, .shard-get .s { animation-fill-mode: forwards; }

button { border-radius: 8px; border-color: var(--line); transition: background .15s, border-color .15s, transform .08s, opacity .15s; letter-spacing: .01em; }
button:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .35; }
@media (hover: hover) { button:hover { border-color: var(--fg); } .btn-main:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); } }
.btn-main { font-weight: 500; }
.title button, #choices button { border-radius: 0; }

.hud { font-size: 12.5px; line-height: 1.6; letter-spacing: .03em; opacity: .9; padding-top: calc(13px + env(safe-area-inset-top, 0px)); }
#toast { border-radius: 8px; border-color: var(--line); font-size: 13px; padding: 9px 14px; animation: toastin .25s ease; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -6px); } }
#dlg .text { letter-spacing: .005em; }
#dlg .next { opacity: .45; font-size: 9px; }

#mute { color: var(--fg); background: transparent; display: flex; align-items: center; justify-content: center; opacity: .55; }
#mute:hover { opacity: 1; }
#shards { background: transparent; color: var(--accent); font-size: 12px; letter-spacing: .08em; padding: 0; top: calc(15px + env(safe-area-inset-top, 0px)); right: 16px; }

/* 엔딩: 영수증처럼 정돈된 표 */
.ending { gap: 18px; }
.ending h2 { font-size: 26px; letter-spacing: .08em; }
.ending ul { width: 100%; max-width: 320px; font-size: 14px; line-height: 1.5; }
.ending li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ending li span { opacity: .65; }
.ending li b { font-weight: 500; text-align: right; }
.ending .bulb { font-size: 56px; }
.ending .btns { margin-top: 2px; }
.ending .btns button { font-size: 14px; padding: 10px 16px; }
@media (max-height: 640px) { .ending { gap: 10px; padding: 16px 24px; } .ending li { padding: 4px 0; font-size: 13px; } .ending .bulb { font-size: 40px; } .ending h2 { font-size: 22px; } }

.shard-get .l { letter-spacing: .2em; font-size: 12px; }
.shard-get .s { font-size: 52px; }
.shard-get .c { letter-spacing: .15em; font-size: 12px; }
.credits h3 { letter-spacing: .3em; font-size: 11px; }
.daycard .t { letter-spacing: .02em; }
.mini-fridge .cell, .mini-shop .prod { transition: transform .12s, border-color .15s; }

/* 큰 화면에서는 가는 테두리의 창처럼 */
@media (min-width: 520px) and (min-height: 640px) { #app { border: 1px solid rgba(255,255,255,.09); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); } }

/* 숨겨 둔 것 */
.ghostspot { width: 34px; height: 34px; display: flex; gap: 7px; align-items: center; justify-content: center; font-size: 0; }
.ghostspot i { width: 4px; height: 6px; border-radius: 50%; background: #d9d6c8; opacity: .5; }
.ghost { position: absolute; inset: 0; z-index: 70; background: #000; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ghost svg { width: 96%; max-height: 96%; filter: blur(1px) contrast(1.35) brightness(1.1); animation: ghostin .65s steps(6) forwards; }
@keyframes ghostin { 0% { transform: scale(.7); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(1.5); opacity: 1; } }

.ending .by { font-family: "IBM Plex Sans KR", sans-serif; font-size: 11px; letter-spacing: .25em; opacity: .5; }

/* 이스터에그 1: 잠금 화면의 광고 알림 */
#stage.lock { background: #0b0d12; color: #f2f4f8; font-family: "IBM Plex Sans KR", sans-serif; }
.lock .cbar { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 52px; right: 60px; display: flex; justify-content: space-between; font-size: 12px; color: #aeb4c0; }
.lock .cbar b { color: #ff6b5e; font-weight: 500; }
.lock .clock { position: absolute; top: 14%; width: 100%; text-align: center; font-size: 68px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.lock .day { position: absolute; top: calc(14% + 82px); width: 100%; text-align: center; font-size: 14px; color: #aeb4c0; }
.lock .noti { position: absolute; top: calc(14% + 140px); left: 16px; right: 16px; background: #1c2029; border-radius: 14px; padding: 13px 15px; font-size: 14px; line-height: 1.55; }
.lock .noti b { display: block; font-size: 11px; color: #ffd66e; font-weight: 500; margin-bottom: 2px; }
/* 이스터에그 2: 타이틀 불 끄기 */
.title .bulb { cursor: default; }
.title > * { transition: opacity 1.2s; }
.title .tnames { position: absolute; left: 24px; right: 24px; top: 46%; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; opacity: 0; pointer-events: none; font-family: var(--serif); font-size: 13px; color: #ffd66e; }
.title.off > *:not(.bulb):not(.tnames) { opacity: 0; pointer-events: none; }
.title.off .bulb { animation: none; opacity: .18; filter: none; }
.title.off .bulb::before { display: none; }
.title.off .tnames { opacity: 1; }
.title.off .tnames span { animation: fadein 1.6s both; text-shadow: 0 0 10px rgba(255,214,110,.7); }
/* 이스터에그 3: 늦게 나타나는 선택지 */
#choices button.late { animation: fadein 3s; opacity: .7; }

.true-note { color: var(--accent); }
