:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1d2230;
  --muted: #6b6f7b;
  --line: #e3ded2;
  --navy: #1b2340;
  --navy-2: #2a3560;
  --green: #1fa463;
  --green-soft: #e3f5ec;
  --red: #e0483e;
  --win-off: #39436b;
  --win-on: #ffd66b;
  --title: 'Black Han Sans', 'Gowun Dodum', sans-serif;
  --body: 'Gowun Dodum', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --mono: 'Nanum Gothic Coding', ui-monospace, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.home-link { position: absolute; top: 14px; left: 16px; color: #c9cde0; text-decoration: none; font-size: 14px; z-index: 5; }
.home-link:hover { color: #fff; }

/* ---------- 히어로 ---------- */
.hero { background: linear-gradient(180deg, #121833 0%, var(--navy) 60%, var(--navy-2) 100%); color: #fff; padding: 64px 16px 0; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: end; max-width: none; }
.hero > * { max-width: 100%; }
.hero-text { max-width: 640px; justify-self: end; width: 100%; padding-bottom: 40px; }
.eyebrow { color: #9fa8d6; font-size: 14px; letter-spacing: .04em; margin-bottom: 8px; }
.hero h1 { font-family: var(--title); font-weight: 400; font-size: clamp(40px, 7vw, 72px); line-height: 1.02; }
.lead { margin-top: 16px; font-size: 18px; color: #dfe3f5; }
.fact { margin-top: 18px; font-size: 15px; color: #c9cde0; background: rgba(255,255,255,.07); border-radius: 10px; padding: 10px 14px; }
.fact b { color: var(--win-on); }
.building { width: 220px; justify-self: start; }
.building svg { display: block; width: 100%; }
.building .wall { fill: #2f3a66; stroke: #48548a; stroke-width: 2; }
.building .roof { fill: #48548a; }
.building .sign { fill: #9fa8d6; font: 700 11px var(--body); }
.building .door { fill: #1b2340; }
.building .ground { fill: #121833; }
.building .win { fill: var(--win-off); transition: fill .4s; }
.building .win.on { fill: var(--win-on); }

/* ---------- 남은 돈 바 ---------- */
.moneybar { position: sticky; top: 0; z-index: 10; background: var(--green); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.moneybar-inner { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.money-label { font-size: 13px; opacity: .85; }
.money { font-family: var(--title); font-size: clamp(28px, 5vw, 44px); line-height: 1.05; font-variant-numeric: tabular-nums; }
.money-side { flex: 1 1 260px; max-width: 420px; }
.money-unit { font-weight: 700; font-size: 16px; text-align: right; }
.progress { height: 8px; background: rgba(255,255,255,.3); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.progress span { display: block; height: 100%; width: 0; background: #fff; border-radius: 99px; transition: width .4s; }
.spent { font-size: 12px; text-align: right; opacity: .9; }

/* ---------- 상품 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 40px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 14px 14px; text-align: center; display: grid; gap: 6px; transition: border-color .2s, box-shadow .2s; }
.item.owned { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.icon { font-size: 44px; line-height: 1; width: 76px; height: 76px; margin: 0 auto 4px; display: grid; place-items: center; background: #f4f1ea; border-radius: 50%; }
.item h3 { font-size: 16px; font-weight: 700; min-height: 2.6em; display: grid; place-items: center; line-height: 1.3; }
.price { color: var(--green); font-weight: 700; font-size: 15px; }
.ctrl { display: grid; grid-template-columns: 1fr 64px 1fr; gap: 6px; margin-top: 6px; }
.ctrl button { border: 0; border-radius: 10px; padding: 9px 0; font-weight: 700; transition: filter .1s, opacity .1s; }
.ctrl button:hover:not(:disabled) { filter: brightness(.95); }
.ctrl button:disabled { opacity: .35; cursor: not-allowed; }
.sell { background: #fde7e5; color: var(--red); }
.buy { background: var(--green); color: #fff; }
.ctrl input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; text-align: center; font: 700 15px var(--mono); padding: 6px 2px; -moz-appearance: textfield; color: var(--ink); background: #fff; }
.ctrl input::-webkit-outer-spin-button, .ctrl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ctrl :focus-visible, .btn:focus-visible { outline: 3px solid #3b6fe0; outline-offset: 2px; }

/* ---------- 영수증 ---------- */
.receipt-wrap { margin-top: 48px; display: grid; justify-items: center; gap: 16px; }
.receipt { width: 100%; max-width: 420px; background: #fffdf8; padding: 26px 22px 30px; font-family: var(--mono); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.08); position: relative;
  -webkit-mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 0 0 / 18px 100% repeat-x; mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 0 0 / 18px 100% repeat-x; }
.receipt h2 { font-family: var(--title); font-weight: 400; font-size: 26px; text-align: center; }
.receipt-sub { text-align: center; color: var(--muted); font-size: 12px; margin-top: 2px; }
.dash { border-top: 2px dashed #cfc8b8; margin: 14px 0; }
.receipt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.receipt-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
.receipt-list li span:nth-child(2) { color: var(--muted); }
.receipt-list li span:last-child { min-width: 92px; text-align: right; }
.receipt-list .empty { display: block; text-align: center; color: var(--muted); }
.receipt-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; }
.receipt-total.small { font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.thanks { text-align: center; font-size: 12px; color: var(--muted); }
.receipt-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn { border-radius: 12px; padding: 12px 20px; font-weight: 700; border: 1.5px solid var(--ink); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { background: transparent; }
.note { font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- 토스트 & 푸터 ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .3s, opacity .3s, visibility .3s; opacity: 0; visibility: hidden; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
footer { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; padding: 0 16px 40px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; padding-top: 48px; }
  .hero-text { padding-bottom: 24px; }
  .building { width: 96px; align-self: end; }
  .lead { font-size: 16px; }
  .moneybar-inner { padding: 10px 16px; gap: 6px; }
  .money-side { flex-basis: 100%; max-width: none; }
  .money-unit, .spent { text-align: left; }
  .money-unit { font-size: 14px; }
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item { padding: 14px 10px 10px; }
  .icon { width: 60px; height: 60px; font-size: 34px; }
  .item h3 { font-size: 14px; }
  .ctrl { grid-template-columns: 1fr 44px 1fr; gap: 4px; }
  .ctrl button { padding: 8px 0; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
