/* 픽셀 블럭 타워: 스타의 빌딩 — 게임 UI 스타일 (360×640 논리 화면을 창에 맞춰 확대) */
:root {
  --tomato: #F5382C; --mustard: #FFC21A; --clover: #2DBE5A; --cobalt: #2A7CFF; --plum: #A64BF4;
  --orange: #FF7E1E; --pink: #FF6BB5; --sky: #22BDF5;
  --cream: #FAF7F0; --charcoal: #2B2D3A; --stone: #8A8FA3;
  --panel: #FFFDF7; --line: #E6E0D2; --text: #2B2D3A; --muted: #7A7F94;
  --font: 'Jua', 'Noto Sans KR', system-ui, -apple-system, 'Malgun Gothic', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0f1330; overflow: hidden; font-family: var(--font); color: var(--text); touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #1b2148, #0b0e22 70%); }
#stage { position: relative; width: 360px; height: 640px; overflow: hidden; background: #9FD4F0; transform-origin: center center; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
#cv { position: absolute; inset: 0; width: 360px; height: 640px; display: block; }
.hidden { display: none !important; }
button { font-family: var(--font); cursor: pointer; }

/* ── HUD ── */
#hud { position: absolute; left: 0; right: 0; top: 0; z-index: 4; padding: 6px 6px 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-row { display: flex; gap: 4px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 6px; border-radius: 13px; background: rgba(22,24,40,.82); color: #fff; font-size: 13px; line-height: 1; border: 1px solid rgba(255,255,255,.14); white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pill b { font-weight: 400; }
.pill.plus { cursor: pointer; }
.pill .add { margin-left: 2px; width: 16px; height: 16px; border-radius: 8px; background: var(--clover); color: #fff; display: grid; place-items: center; font-size: 13px; line-height: 1; }
#energy { position: relative; min-width: 96px; }
#energy .bar { position: absolute; left: 6px; right: 26px; bottom: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; }
#energy .bar i { display: block; height: 100%; width: 100%; background: var(--mustard); transition: width .3s; }
#energy.empty { border-color: var(--tomato); animation: blink 1s infinite; }
@keyframes blink { 50% { background: rgba(120,20,20,.85); } }
.spacer { flex: 1; }
#tabs { display: flex; gap: 4px; margin-top: 5px; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-width: 96px; padding: 0 8px; white-space: nowrap; height: 24px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(22,24,40,.7); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 3px; }
.tab.on { background: var(--cobalt); border-color: #fff4; }
#tabs.compact .tab { flex: 0 0 auto; min-width: 38px; padding: 0 6px; }
#tabs.compact .tab.on { flex: 1 1 auto; min-width: 110px; }
.tab.locked { opacity: .75; }
.tab.buy { background: rgba(45,190,90,.85); }

/* ── 아래 바 ── */
#bottombar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; gap: 4px; padding: 6px 6px 8px; background: linear-gradient(to top, rgba(10,12,30,.85), rgba(10,12,30,0)); pointer-events: none; }
#bottombar button { pointer-events: auto; flex: 1; height: 46px; border-radius: 14px; border: 1px solid rgba(255,255,255,.18); background: rgba(22,24,40,.88); color: #fff; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; position: relative; }
#bottombar button .ic { font-size: 19px; line-height: 1; }
#bottombar button.dot::after { content: ''; position: absolute; top: 5px; right: 8px; width: 8px; height: 8px; border-radius: 4px; background: var(--tomato); box-shadow: 0 0 0 2px #fff; }
#bottombar button.locked { opacity: .45; }

/* ── 토스트·배너 ── */
#toasts { position: absolute; left: 0; right: 0; top: 66px; z-index: 9; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.toast { padding: 6px 12px; border-radius: 12px; background: rgba(22,24,40,.9); color: #fff; font-size: 12px; animation: toastIn .25s ease, toastOut .4s ease 2.6s forwards; max-width: 320px; text-align: center; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ── 가이드 대사창 (모카) ── */
#guide { position: absolute; left: 8px; right: 8px; bottom: 64px; z-index: 7; display: none; gap: 8px; align-items: flex-end; padding: 8px 10px 10px; border-radius: 14px; background: rgba(255,253,247,.97); color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.35); border: 2px solid #fff; }
#guide.show { display: flex; animation: toastIn .25s ease; }
#guide.top { bottom: auto; top: 76px; }
#guide .face { width: 56px; height: 56px; border-radius: 12px; background: #FFE9B0; overflow: hidden; flex: none; border: 2px solid #F2B233; }
#guide .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
#guide .body { flex: 1; min-width: 0; }
#guide .name { font-size: 11px; color: var(--orange); margin-bottom: 2px; }
#guide .text { font-size: 13px; line-height: 1.4; min-height: 36px; word-break: keep-all; }
#guide .next { font-size: 10px; color: var(--muted); text-align: right; margin-top: 3px; }
#pointer { position: absolute; z-index: 9; width: 34px; height: 34px; pointer-events: none; display: none; font-size: 30px; line-height: 34px; text-align: center; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); animation: bounce .7s infinite alternate ease-in-out; }
#pointer.show { display: block; }
@keyframes bounce { from { transform: translateY(-6px); } to { transform: translateY(4px); } }

/* ── 패널 (바텀 시트) ── */
#panel { position: absolute; inset: 0; z-index: 8; display: none; background: rgba(8,10,25,.55); }
#panel.show { display: block; }
.sheet { position: absolute; left: 6px; right: 6px; bottom: 6px; max-height: 84%; border-radius: 18px; background: var(--panel); border: 2px solid #fff; box-shadow: 0 -10px 40px rgba(0,0,0,.4); display: flex; flex-direction: column; animation: sheetIn .25s ease; overflow: hidden; }
@keyframes sheetIn { from { transform: translateY(30px); opacity: 0; } }
.sheet .head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.sheet .head h3 { margin: 0; font-size: 16px; font-weight: 400; flex: 1; }
.sheet .head .x { width: 28px; height: 28px; border-radius: 14px; border: none; background: #eee; font-size: 14px; }
.sheet .list { overflow-y: auto; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.row .ic { width: 38px; height: 38px; border-radius: 10px; background: #FFF3D6; display: grid; place-items: center; font-size: 22px; flex: none; }
.row .info { flex: 1; min-width: 0; }
.row .info .n { font-size: 13px; }
.row .info .d { font-size: 10px; color: var(--muted); }
.row .info .lv { font-size: 10px; color: var(--cobalt); }
.buy { height: 30px; min-width: 74px; padding: 0 10px; border-radius: 15px; border: none; background: var(--clover); color: #fff; font-size: 12px; box-shadow: 0 2px 0 #1e8a40; }
.buy.gem { background: var(--plum); box-shadow: 0 2px 0 #7a2ec4; }
.buy.max { background: #cfd3dd; color: #666; box-shadow: none; }
.buy:disabled { background: #cfd3dd; color: #777; box-shadow: none; }
.buy.free { background: var(--orange); box-shadow: 0 2px 0 #c45f10; }
.note { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.center { text-align: center; padding: 14px 12px; }
.center h2 { margin: 0 0 6px; font-size: 20px; font-weight: 400; }
.center p { margin: 6px 0; font-size: 13px; line-height: 1.5; word-break: keep-all; }
.big { height: 40px; padding: 0 22px; border-radius: 20px; border: none; background: var(--cobalt); color: #fff; font-size: 15px; box-shadow: 0 3px 0 #1a56c4; margin: 4px; }
.big.green { background: var(--clover); box-shadow: 0 3px 0 #1e8a40; }
.big.gray { background: #cfd3dd; color: #555; box-shadow: 0 3px 0 #a5a9b3; }
.big.red { background: var(--tomato); box-shadow: 0 3px 0 #b0261c; }
.small { height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 12px; }
.vol label { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 4px 0; }
.vol input { flex: 1; }

/* ── 컷신 ── */
#cutscene { position: absolute; inset: 0; z-index: 12; display: none; background: #06081a; flex-direction: column; }
#cutscene.show { display: flex; animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; } }
#cutscene .title { text-align: center; color: #FFC21A; font-size: 13px; padding: 8px 0 0; letter-spacing: 1px; height: 26px; }
#cutscene .pic { flex: 1; display: grid; place-items: center; padding: 4px 8px; min-height: 0; }
#cutscene .pic img { max-width: 100%; max-height: 100%; border-radius: 12px; border: 2px solid #ffffff22; object-fit: contain; animation: kb 12s ease-in-out infinite alternate; }
@keyframes kb { to { transform: scale(1.04); } }
#cutscene .pic .noimg { width: 100%; height: 100%; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #2a3270, #0b0e22 70%); display: grid; place-items: center; color: #fff9; font-size: 40px; }
.dlg { margin: 0 8px 10px; border-radius: 14px; background: rgba(255,253,247,.97); padding: 10px 12px 12px; min-height: 96px; display: flex; gap: 10px; align-items: flex-start; border: 2px solid #fff; }
.dlg .port { width: 64px; height: 64px; border-radius: 12px; background: #eef; overflow: hidden; flex: none; border: 2px solid #ddd; display: grid; place-items: center; font-size: 34px; }
.dlg .port img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.dlg .who { font-size: 12px; color: var(--orange); }
.dlg .txt { font-size: 14px; line-height: 1.45; word-break: keep-all; min-height: 42px; }
.dlg .tap { font-size: 10px; color: var(--muted); text-align: right; }
#cutscene .skip { position: absolute; top: 8px; right: 10px; height: 24px; padding: 0 10px; border-radius: 12px; border: 1px solid #fff4; background: #0006; color: #fff; font-size: 11px; }

/* ── 로딩 / 타이틀 ── */
#loading { position: absolute; inset: 0; z-index: 20; background: #2A7CFF; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: #fff; }
#loading img { width: 78%; max-width: 300px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
#loading .sub { font-size: 16px; letter-spacing: 2px; color: #FFC21A; margin-top: -8px; }
#loading .bar { width: 70%; height: 20px; border-radius: 10px; background: rgba(0,0,0,.28); overflow: hidden; position: relative; border: 2px solid #fff6; }
#loading .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#FFD65A, #FFC21A); transition: width .15s; }
#loading .bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: #2B2D3A; }
#loading .tip { font-size: 12px; color: #fffc; padding: 0 30px; text-align: center; }
#title { position: absolute; inset: 0; z-index: 19; display: none; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 70px; gap: 12px; background: linear-gradient(#22BDF5, #9FD4F0 55%, #2DBE5A 56%, #1e8a40); }
#title.show { display: flex; animation: fade .6s ease; }
#title .logo { position: absolute; top: 46px; width: 86%; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
#title .sub { position: absolute; top: 212px; font-size: 22px; color: #fff; text-shadow: 0 3px 0 #1a56c4; letter-spacing: 3px; }
#title .hero { position: absolute; bottom: 138px; height: 240px; filter: drop-shadow(0 10px 10px rgba(0,0,0,.3)); animation: bounce 1.6s infinite alternate ease-in-out; }
#title .big { position: relative; z-index: 2; font-size: 20px; height: 52px; padding: 0 40px; border-radius: 26px; }
#title .tiny { position: relative; z-index: 2; }
#title .tiny { font-size: 11px; color: #fffc; }

/* ── 영화 제작 ── */
#movie { position: absolute; inset: 0; z-index: 11; display: none; background: #12152e; color: #fff; flex-direction: column; }
#movie.show { display: flex; animation: fade .4s ease; }
#movie .mhead { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #0b0e22; }
#movie .mhead h3 { margin: 0; flex: 1; font-size: 15px; font-weight: 400; }
#movie .steps { display: flex; gap: 4px; padding: 6px 10px 0; }
#movie .step { flex: 1; height: 22px; border-radius: 11px; background: #ffffff18; font-size: 11px; display: grid; place-items: center; color: #fff9; }
#movie .step.on { background: var(--mustard); color: #2B2D3A; }
#movie .step.done { background: var(--clover); color: #fff; }
#movie .step.lock { opacity: .4; }
#movie .mbody { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 8px 10px; gap: 8px; }
#movie .mbody.set { background-size: cover; background-position: center bottom; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.card { border-radius: 12px; background: #fff; color: var(--text); padding: 8px 4px; text-align: center; border: 3px solid transparent; font-size: 11px; }
.card .e { font-size: 26px; line-height: 1.1; }
.card .g { font-size: 10px; color: var(--muted); }
.card.sel { border-color: var(--mustard); box-shadow: 0 0 0 2px #fff5; }
.genres { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.genre { border-radius: 12px; background: #fff; color: var(--text); padding: 12px 4px; text-align: center; font-size: 14px; border: 3px solid transparent; }
.genre.sel { border-color: var(--mustard); }
.mtext { font-size: 13px; line-height: 1.45; text-align: center; word-break: keep-all; color: #fffd; }
.mbig { font-size: 20px; text-align: center; }
.timing { position: relative; height: 30px; border-radius: 15px; background: rgba(0,0,0,.6); overflow: hidden; margin: 8px 0; border: 2px solid #fff4; }
.timing .zone { position: absolute; top: 0; bottom: 0; background: var(--clover); opacity: .85; }
.timing .zone.p { background: var(--mustard); }
.timing .mark { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #fff; border-radius: 3px; box-shadow: 0 0 6px #fff; }
.takes { display: flex; gap: 4px; justify-content: center; }
.takes i { width: 22px; height: 22px; border-radius: 11px; background: #ffffff22; display: grid; place-items: center; font-style: normal; font-size: 13px; }
.takes i.ok { background: var(--clover); } .takes i.pf { background: var(--mustard); color: #2B2D3A; } .takes i.ng { background: var(--tomato); }
.shootbtn { height: 64px; border-radius: 32px; border: none; background: var(--tomato); color: #fff; font-size: 22px; box-shadow: 0 5px 0 #b0261c; margin: 6px auto; width: 200px; }
.shootbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b0261c; }
.clips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.clip { border-radius: 12px; background: #fff; color: var(--text); padding: 10px 4px; text-align: center; font-size: 12px; border: 3px solid transparent; }
.clip .e { font-size: 28px; }
.clip.done { background: var(--clover); color: #fff; }
.clip.bad { border-color: var(--tomato); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.poster { margin: 0 auto; width: 220px; border-radius: 12px; overflow: hidden; border: 4px solid #FFC21A; box-shadow: 0 10px 30px #0008; background: #000; }
.poster canvas { display: block; width: 100%; }
.stars { font-size: 26px; text-align: center; letter-spacing: 2px; }
#movie .mfoot { display: flex; gap: 6px; justify-content: center; padding: 8px 10px 12px; background: #0b0e22; }

/* ── 층 관리 상단 요약 ── */
.sum { display: flex; gap: 6px; padding: 8px 10px 0; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.sum span { background: #f3f0e8; border-radius: 8px; padding: 3px 7px; }

/* ── HUD 2줄 (별·레벨 추가) ── */
.pill.icon { padding: 0 7px; cursor: pointer; }
.pill .bar { position: absolute; left: 6px; right: 26px; bottom: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; }
.pill .bar i { display: block; height: 100%; width: 0; background: var(--mustard); transition: width .3s; }
#level { position: relative; min-width: 58px; padding-right: 8px; }
#level .bar { right: 6px; }
#level .bar.xp i { background: var(--sky); }
#hud .hud-row + .hud-row { margin-top: 4px; }
#tabs { margin-top: 4px; }

/* ── 퍼즐 (배우의 하루) ── */
#puzzle { position: absolute; inset: 0; z-index: 6; display: none; background: #0f1330; }
#puzzle.show { display: block; }
#puzzle canvas { position: absolute; inset: 0; width: 360px; height: 640px; display: block; touch-action: none; }
.pz-close { position: absolute; top: 6px; right: 6px; z-index: 3; height: 24px; padding: 0 10px; border-radius: 12px; border: 1px solid #fff4; background: #0009; color: #fff; font-size: 11px; }
.pz-ov { position: absolute; inset: 0; z-index: 2; display: none; place-items: center; text-align: center; padding: 24px; background: rgba(10,12,32,.82); }
.pz-ov.show { display: grid; }
.pz-ov.win { background: rgba(10,12,32,.42); }   /* 클리어 팝업: 뒤의 폭죽·종이가루가 보이게 옅게 */
.pz-ov > * { align-self: center; }
.pz-ov-title { font-size: 30px; color: var(--mustard); }
.pz-ov-msg { color: #fff; white-space: pre-line; margin: 8px 0 16px; font-size: 13px; line-height: 1.6; word-break: keep-all; }
.pz-ov-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pz-ov-btn { padding: 10px 22px; border-radius: 12px; border: 0; background: var(--tomato); color: #fff; font-size: 15px; box-shadow: 0 4px 0 #a93b1c; }
.pz-ov-btn.ghost { background: rgba(255,255,255,.12); box-shadow: none; border: 1px solid rgba(255,255,255,.25); }
.pz-ov-btn:disabled { opacity: .45; }

/* ── 배우의 생활 카드 ── */
#life { position: absolute; inset: 0; z-index: 10; display: none; background: rgba(6,8,26,.92); flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
#life.show { display: flex; animation: fade .4s ease; }
.life-card { width: 100%; border-radius: 18px; background: var(--panel); overflow: hidden; border: 2px solid #fff; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.life-card img { width: 100%; display: block; aspect-ratio: 3 / 2; object-fit: cover; background: #223; }
.life-body { padding: 12px 14px 6px; }
.life-kicker { font-size: 11px; color: var(--orange); }
.life-title { font-size: 20px; margin: 2px 0 6px; }
.life-text { font-size: 13px; line-height: 1.5; color: var(--text); word-break: keep-all; min-height: 40px; }
.life-foot { display: flex; gap: 8px; justify-content: center; padding: 4px 14px 14px; }
