/* 별빛 상회: 가게 안·지도는 픽셀 그림(캔버스), 창·버튼·HUD 는 다른 Leapinity 게임과 같은 키트 모양 (흰 둥근 카드·분홍→보라) */
:root { --bs: var(--kit-btn-scale, 1); --fs: 1; --ink: #2f3550; --muted: #7a809c; --accent: #8b7cf6; --pink: #ff8fb8; --good: #1f9d63; --bad: #d9486b; --warn: #d97a2b; --gold: #f5a524; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-family: "Pretendard Variable", "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; background: #141a33; color: var(--ink); word-break: keep-all; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.hidden { display: none !important; }
button { font-family: inherit; }

#stage { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse 70% 60% at 50% 40%, #1f2850 0%, #12172e 100%); }
#cv { display: block; image-rendering: pixelated; touch-action: none; border-radius: 6px; }

/* 위쪽 줄 (게임 이름 · 계정 칩 · 설정) */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 9060; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 14px) 8px calc(env(safe-area-inset-left) + 14px); pointer-events: none; }
.top > * { pointer-events: auto; }
.top h1 { margin: 0; font-size: 16px; font-weight: 900; color: #fff; padding: 7px 14px; border-radius: 99px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); letter-spacing: -.3px; }
#accountSlot { margin-left: auto; }
body.night .top, body.boot .top { display: none; }
.round { width: calc(40px * var(--bs)); height: calc(40px * var(--bs)); flex: none; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: #5b5f86; font-size: calc(17px * var(--bs)); font-weight: 900; box-shadow: 0 4px 12px rgba(10, 10, 40, .25); cursor: pointer; display: grid; place-items: center; padding: 0; }
.round.wide { width: auto; padding: 0 12px; border-radius: 99px; font-size: calc(14px * var(--bs)); }
.round:active { transform: scale(.94); }

/* 첫 화면 */
.screen { position: fixed; inset: 0; z-index: 10; }
#home { display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 64px) 16px calc(env(safe-area-inset-bottom) + 14px); pointer-events: none; }
#home > * { pointer-events: auto; }
.hero { text-align: center; pointer-events: none !important; }
.title-word { margin: 6px auto 4px; font-size: 54px; font-weight: 900; line-height: 1.1; letter-spacing: -1.5px; color: #ffe08a; text-shadow: 0 0 22px rgba(255, 200, 90, .45), 0 4px 0 #8a4d2a; animation: bob 2.6s ease-in-out infinite; }
.title-sub { margin: 0 auto 10px; font-size: 15px; font-weight: 800; color: #d9dcf5; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
@keyframes bob { 50% { transform: translateY(-5px); } }
.best { margin: 0 auto; display: inline-block; padding: 6px 14px; border-radius: 99px; background: rgba(255, 255, 255, .9); font-weight: 800; font-size: 14px; color: #8b5cf6; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.best:empty { display: none; }
.spacer { flex: 1; min-height: 12px; pointer-events: none !important; }
.panel { width: 100%; max-width: 440px; margin: 0 auto; padding: 14px; border-radius: 24px; background: rgba(255, 255, 255, .94); border: 1px solid #ece8f4; box-shadow: 0 14px 40px rgba(0, 0, 0, .3); display: grid; gap: 8px; max-height: 62vh; overflow-y: auto; }
.big { padding: calc(13px * var(--bs)) 12px; border-radius: calc(16px * var(--bs)); border: 0; font: inherit; font-weight: 900; font-size: calc(16px * var(--bs)); cursor: pointer; transition: transform .1s; line-height: 1.3; }
.big:active { transform: scale(.97); }
.big small { display: block; font-size: 12.5px; font-weight: 700; opacity: .9; }
.big.primary { color: #fff; background: linear-gradient(135deg, #ff8fb8, #8b7cf6); box-shadow: 0 8px 20px rgba(139, 124, 246, .32); font-size: calc(18px * var(--bs)); }
.big.ghost { background: #fff; color: var(--accent); border: 1.5px solid #e4def5; }
.howto { border-radius: 16px; background: #faf8ff; border: 1px solid #ece8f4; padding: 8px 12px; }
.howto summary { cursor: pointer; font-weight: 900; font-size: 14px; color: #5b5f86; padding: 2px 0; }
.howto ul { margin: 6px 0 2px; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: #565c7c; }

/* 밤 HUD (키트 알약 모양) */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 10px) 0 calc(env(safe-area-inset-left) + 10px); display: grid; gap: 6px; pointer-events: none; font-size: calc(14px * var(--fs)); }
.hud-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hud-row.small { font-size: .9em; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px; border-radius: 99px; background: rgba(255, 255, 255, .92); box-shadow: 0 4px 12px rgba(10, 10, 40, .25); font-weight: 800; color: #3d4266; white-space: nowrap; }
.chip img { width: 20px; height: 20px; image-rendering: pixelated; }
.chip b { font-weight: 900; color: #2f3550; }
.chip.gold b { color: #b86b00; }
.chip.goal { position: relative; overflow: hidden; }
.chip.goal i { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #ece8f4; }
.chip.goal em { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff8fb8, #8b7cf6); transition: width .3s; }
.hud-btns { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
.flash { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 92px); transform: translateX(-50%); z-index: 25; max-width: min(92vw, 640px); padding: 9px 18px; border-radius: 99px; background: rgba(255, 255, 255, .95); color: #3d2f7a; font-weight: 900; font-size: calc(15px * var(--fs)); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); text-align: center; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.flash.on { opacity: 1; transform: translateX(-50%) translateY(4px); }
.flash.bad { color: #b4234d; }
.hint { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 6px); z-index: 20; margin: 0; text-align: center; color: rgba(230, 234, 255, .85); font-size: calc(13px * var(--fs)); font-weight: 700; text-shadow: 0 1px 4px #000; pointer-events: none; padding: 0 12px; }

/* 창 (키트 kit-modal/kit-sheet 모양 그대로, 여러 장 겹침) */
#layer { position: fixed; inset: 0; z-index: 9050; pointer-events: none; font-size: calc(15px * var(--fs)); }
#layer .ns-modal { z-index: 1; position: fixed; inset: 0; display: grid; place-items: center; padding: calc(env(safe-area-inset-top) + 10px) 12px calc(env(safe-area-inset-bottom) + 10px); background: rgba(14, 12, 40, .5); backdrop-filter: blur(3px); pointer-events: auto; }
#layer .ns-modal.over { z-index: 3; }
body:not(.night) #layer .ns-modal { padding-top: calc(env(safe-area-inset-top) + 60px); }
#layer .ns-sheet { position: relative; width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; padding: 20px 18px; border-radius: 24px; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); animation: kitUp .22s ease-out; }
#layer .ns-sheet.wide { max-width: 940px; }
#layer .ns-sheet.mid { max-width: 700px; }
#layer .ns-head { text-align: center; margin-bottom: 10px; }
#layer .ns-head h2 { margin: 0; font-size: 1.45em; font-weight: 900; letter-spacing: -.5px; background: linear-gradient(90deg, #ff6fa3, #7c6cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
#layer .ns-head p { margin: 4px 0 0; color: var(--muted); font-size: .9em; font-weight: 700; }
#layer .ns-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f3f0ff; color: #7a73b8; font-weight: 900; cursor: pointer; font-size: 15px; }
#layer .kit-btn { font-size: 1em; }
#layer .kit-btn.small { font-size: .87em; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 10px; }
.fact { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; background: #f3f0ff; font-weight: 800; font-size: .92em; color: #4a4f78; }
.fact img { width: 20px; height: 20px; image-rendering: pixelated; }
.fact.gold { background: #fff3d1; color: #9a5b00; }
.fact.warn { background: #ffe9e1; color: #b4502a; }
.fact.good { background: #e3f7ec; color: #1d7a4c; }
.pix { image-rendering: pixelated; }

/* 낮 준비 */
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.act { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 16px; border: 1.5px solid #ece8f4; background: #faf9ff; cursor: pointer; text-align: left; font: inherit; color: var(--ink); min-width: 0; }
.act img { width: 28px; height: 28px; image-rendering: pixelated; flex: none; }
.act b { display: block; font-size: 1em; }
.act small { display: block; color: var(--muted); font-weight: 700; font-size: .82em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act:active { transform: scale(.98); }
.rows { display: grid; gap: 6px; }
.prow { display: grid; grid-template-columns: 34px minmax(70px, 1.1fr) minmax(118px, 1fr) minmax(130px, 1fr) minmax(90px, .9fr); align-items: center; gap: 8px; padding: 7px 10px; border-radius: 16px; background: #faf9ff; border: 1px solid #efecf8; border-left: 5px solid var(--pc, #ccc); }
.prow .pic { width: 30px; height: 30px; image-rendering: pixelated; }
.prow .nm b { display: block; font-weight: 900; }
.prow .nm small { color: var(--muted); font-weight: 700; font-size: .82em; }
.prow .info { font-size: .84em; font-weight: 800; line-height: 1.35; }
.prow .info .up { color: var(--good); } .prow .info .down { color: var(--bad); }
.step { display: grid; gap: 2px; }
.step > small { font-size: .74em; color: var(--muted); font-weight: 800; }
.stepper { display: flex; align-items: center; border-radius: 12px; background: #fff; border: 1.5px solid #e4def5; overflow: hidden; }
.stepper button { width: calc(32px * var(--bs)); height: calc(32px * var(--bs)); border: 0; background: #f3f0ff; color: #7c6cf6; font-weight: 900; font-size: 18px; cursor: pointer; flex: none; }
.stepper button:active { background: #e6e0ff; }
.stepper input { width: 100%; min-width: 0; border: 0; text-align: center; font: inherit; font-weight: 900; font-size: 1em; color: var(--ink); background: transparent; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.lines { margin: 10px 0 0; display: grid; gap: 4px; font-weight: 800; font-size: .9em; }
.lines .ok { color: var(--good); } .lines .warn { color: var(--warn); } .lines .bad { color: var(--bad); } .lines .info { color: #4a4f78; }
.ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 4px; padding: 10px 12px; border-radius: 16px; background: #f6f4ff; font-weight: 800; font-size: .92em; }
.ctrl label { display: inline-flex; align-items: center; gap: 6px; }
.ctrl select { font: inherit; font-weight: 800; padding: 5px 8px; border-radius: 10px; border: 1.5px solid #e4def5; background: #fff; color: var(--ink); }
.ctrl input[type=range] { width: min(240px, 40vw); accent-color: #8b7cf6; }
.ctrl .tv { color: #6b4fd8; }
.seg { display: inline-flex; border-radius: 12px; overflow: hidden; border: 1.5px solid #e4def5; }
.seg button { border: 0; background: #fff; padding: 6px 11px; font-weight: 800; cursor: pointer; color: #6b6f92; font-size: .95em; }
.seg button.on { background: linear-gradient(135deg, #ff8fb8, #8b7cf6); color: #fff; }
.startbar { position: sticky; bottom: -20px; margin: 8px -18px -20px; padding: 10px 18px 14px; background: linear-gradient(transparent, #fff 30%); }
.startbar .kit-btn { width: 100%; }

/* 정산 · 신문 · 성적표 줄 */
.ledger { display: grid; gap: 3px; }
.ledger .sec { margin-top: 8px; padding: 4px 10px; border-radius: 10px; background: #f3f0ff; color: #6b4fd8; font-weight: 900; font-size: .86em; }
.ledger .row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 10px; font-weight: 700; }
.ledger .row b { font-variant-numeric: tabular-nums; }
.ledger .row b.up { color: var(--good); } .ledger .row b.down { color: var(--bad); }
.ledger .note { padding: 2px 10px; color: #5b5f86; font-size: .9em; font-weight: 700; }
.ledger .key { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 16px; background: linear-gradient(135deg, #fff4d6, #ffe5ef); font-weight: 900; font-size: 1.15em; }
.ledger .key b.up { color: var(--good); } .ledger .key b.down { color: var(--bad); }
.ledger .total { margin-top: 6px; padding: 8px 12px; border-radius: 14px; background: #f6f4ff; font-weight: 900; text-align: center; }
.ledger .rep { padding: 6px 10px; font-weight: 800; color: #8b4fc0; }
.ledger .rec { padding: 4px 10px; font-weight: 800; color: #b86b00; text-align: center; }
.goldline { margin: 8px 0 0; text-align: center; font-weight: 900; color: #b86b00; }

/* 가게 고르기 */
.picks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pick { display: grid; gap: 6px; padding: 12px; border-radius: 18px; border: 1.5px solid #ece8f4; background: #faf9ff; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.pick:hover { border-color: #c9bdfb; }
.pick:active { transform: scale(.98); }
.pick .ph { display: flex; align-items: center; gap: 8px; }
.pick .ph img { width: 40px; height: 40px; image-rendering: pixelated; }
.pick .ph b { font-size: 1.2em; font-weight: 900; }
.pick .goods { display: flex; gap: 3px; }
.pick .goods img { width: 24px; height: 24px; image-rendering: pixelated; }
.pick small { color: var(--muted); font-weight: 700; line-height: 1.45; }
.pick .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pick .tags span { padding: 2px 8px; border-radius: 99px; background: #fff; border: 1px solid #ece8f4; font-size: .78em; font-weight: 800; color: #5b5f86; }

/* 홍보 */
.promos { display: grid; gap: 8px; }
.promo { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 1.5px solid #ece8f4; background: #faf9ff; cursor: pointer; font: inherit; text-align: left; color: var(--ink); }
.promo .ck { width: 24px; height: 24px; border-radius: 8px; border: 2px solid #c9bdfb; flex: none; display: grid; place-items: center; color: #fff; font-weight: 900; }
.promo.on { border-color: #8b7cf6; background: #f3f0ff; }
.promo.on .ck { background: linear-gradient(135deg, #ff8fb8, #8b7cf6); border-color: transparent; }
.promo:disabled { opacity: .45; cursor: default; }
.promo b { display: block; } .promo small { color: var(--muted); font-weight: 700; }
.promo .pc { margin-left: auto; font-weight: 900; color: #b86b00; white-space: nowrap; }

/* 지도 */
.mapwrap { display: grid; grid-template-columns: auto minmax(240px, 1fr); gap: 12px; align-items: start; }
.mapbox { border-radius: 14px; overflow: hidden; line-height: 0; background: #0e1c33; box-shadow: inset 0 0 0 2px #e4def5; }
.mapbox canvas { cursor: pointer; touch-action: manipulation; image-rendering: pixelated; }
.side { display: grid; gap: 8px; align-content: start; min-width: 0; }
.side h3 { margin: 0; font-size: 1.1em; font-weight: 900; }
.side .state { display: inline-block; padding: 3px 10px; border-radius: 99px; font-weight: 900; font-size: .85em; background: #f3f0ff; color: #6b4fd8; justify-self: start; }
.side .state.warn { background: #ffe9e1; color: #b4502a; } .side .state.gold { background: #fff3d1; color: #9a5b00; } .side .state.cyan { background: #dff7f4; color: #11786a; }
.side .detail { white-space: pre-line; font-size: .9em; line-height: 1.55; color: #4a4f78; font-weight: 600; }
.side .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side .btns .kit-btn { padding: 9px 8px; font-size: .86em; line-height: 1.3; }
.side .btns .wide2 { grid-column: span 2; }
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.types button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; border: 1.5px solid #ece8f4; background: #fff; font: inherit; font-weight: 800; font-size: .78em; cursor: pointer; color: var(--ink); }
.types button img { width: 28px; height: 28px; image-rendering: pixelated; }
.types button.on { border-color: #8b7cf6; background: #f3f0ff; }
.legend { font-size: .8em; color: var(--muted); font-weight: 700; }
.mapinfo { text-align: center; font-weight: 800; color: #4a4f78; font-size: .9em; margin: -4px 0 8px; }

/* 신문 */
.paper { background: #f5f0db; border-radius: 16px; padding: 14px 16px; color: #38332a; font-family: inherit; }
.paper h3 { margin: 0; text-align: center; font-size: 2em; font-weight: 900; letter-spacing: 2px; }
.paper .issue { text-align: center; color: #7a7262; font-weight: 700; font-size: .88em; border-bottom: 3px double #38332a; padding-bottom: 8px; margin-bottom: 10px; }
.paper .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.paper .st { display: grid; grid-template-columns: auto 1fr auto; gap: 3px 10px; font-size: .9em; font-weight: 700; }
.paper .st .u { color: #2a6e33; } .paper .st .d { color: #a3341f; } .paper .st .z { color: #8a8270; }
.paper .pie { display: flex; gap: 10px; align-items: center; }
.paper .leg { display: grid; gap: 3px; font-size: .85em; font-weight: 700; }
.paper .leg span { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.paper .adv { margin-top: 10px; padding-top: 8px; border-top: 2px solid #38332a; font-size: .92em; line-height: 1.6; font-weight: 600; }
.paper h4 { margin: 0 0 6px; font-size: 1em; }

/* 성적표 */
.grade { text-align: center; margin: 4px 0 10px; }
.grade b { display: block; font-size: 2em; font-weight: 900; background: linear-gradient(90deg, #ff6fa3, #7c6cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.grade small { color: var(--muted); font-weight: 800; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 설정 */
.setrow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-weight: 800; }
.setrow > span:first-child { min-width: 86px; }
.setrow input[type=range] { flex: 1; accent-color: #8b7cf6; }
.setrow .val { min-width: 44px; text-align: right; color: var(--muted); }
.credit { margin-top: 10px; font-size: .85em; color: var(--muted); line-height: 1.6; text-align: center; }

@media (max-width: 760px) {
  .acts { grid-template-columns: 1fr 1fr 1fr; }
  .act { flex-direction: column; text-align: center; gap: 4px; padding: 8px 4px; }
  .act small { white-space: normal; }
  .prow { grid-template-columns: 30px 1fr 1fr; }
  .prow .info { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
  .mapwrap { grid-template-columns: 1fr; justify-items: center; }
  .paper .cols, .two { grid-template-columns: 1fr; }
  .picks { grid-template-columns: 1fr; }
}
/* 휴대폰 가로 (낮은 화면) */
@media (max-height: 500px) {
  #layer .ns-sheet { padding: 14px 14px; border-radius: 18px; }
  #layer .ns-head { margin-bottom: 6px; } #layer .ns-head h2 { font-size: 1.2em; }
  .startbar { bottom: -14px; margin: 6px -14px -14px; padding: 8px 14px 10px; }
  .title-word { font-size: 38px; } .title-sub { display: none; }
  #home { padding-top: calc(env(safe-area-inset-top) + 52px); }
  .panel { max-height: 70vh; padding: 10px; }
  .big { padding: 10px; }
  .prow { grid-template-columns: 30px minmax(60px, 1fr) minmax(108px, 1fr) minmax(118px, 1fr) minmax(80px, .9fr); padding: 5px 8px; }
  .prow .info { grid-column: auto; display: block; }
  .acts .act { flex-direction: row; text-align: left; }
  .mapwrap { grid-template-columns: auto minmax(200px, 1fr); justify-items: stretch; }
  .hud { gap: 4px; } .chip { padding: 3px 9px 3px 5px; } .chip img { width: 16px; height: 16px; }
  .flash { top: calc(env(safe-area-inset-top) + 70px); }
}
@media (prefers-reduced-motion: reduce) { .title-word { animation: none; } }
.legend2 { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .86em; font-weight: 800; color: #4a4f78; }
.legend2 i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; box-sizing: border-box; }
