* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --ink: #1d1d1f;
  --sub: #6e6e73;
  --line: #d2d2d7;
  --blue: #0066cc;
  --blue-v: #0a84ff;
  --orange: #ff9500;
  --green: #34c759;
}
html, body { height: 100%; }
body {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 50% -8%, #f0f4ff 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100%;
  display: flex; justify-content: center;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.wrap {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column;
  padding: 14px 12px 28px;
  gap: 12px;
}

/* topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.title h1 {
  font-size: 22px; font-weight: 700; letter-spacing: -.022em; color: var(--ink);
}
.title p { font-size: 12px; color: var(--sub); margin-top: 2px; letter-spacing: -.01em; }
.tools { display: flex; gap: 6px; }
.tbtn {
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 8px 10px; min-width: 40px; cursor: pointer;
  transition: background .15s, transform .05s, border-color .15s;
}
.tbtn:hover { background: var(--bg-alt); }
.tbtn:active { transform: scale(.94); }
.tbtn.on { background: var(--blue-v); border-color: transparent; color: #fff; }

/* stage / canvas — Apple 카드 */
.stage {
  position: relative;
  border-radius: 22px; overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 10px 34px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
}
#game { display: block; width: 100%; height: auto; touch-action: none; }

/* shop */
.shop { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.up {
  position: relative; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px 9px;
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 15px;
  color: var(--ink); transition: background .15s, transform .05s, border-color .15s, box-shadow .15s;
}
.up:hover { background: var(--bg-alt); }
.up:active { transform: scale(.96); }
.up:disabled { opacity: .4; cursor: not-allowed; }
.up.afford { border-color: var(--blue-v); box-shadow: 0 0 0 2px rgba(10,132,255,.12); }
.up .ico { font-size: 19px; line-height: 1; }
.up .t { font-size: 10.5px; font-weight: 600; color: var(--sub); letter-spacing: -.01em; }
.up .lv { font-size: 10px; color: var(--blue); font-weight: 700; }
.up .cost { font-size: 12.5px; font-weight: 700; color: var(--orange); }
.up .cost::before { content: "◆ "; font-size: 9px; opacity: .85; }

.hint { font-size: 11.5px; color: var(--sub); text-align: center; line-height: 1.55; padding: 0 6px; letter-spacing: -.01em; }
.hint b { color: var(--ink); font-weight: 600; }

.credits {
  font-size: 11px; color: #86868b; text-align: center; line-height: 1.7;
  border-top: 1px solid var(--line); padding-top: 14px;
}
.credits a { color: var(--blue); text-decoration: none; }
.credits a:hover { text-decoration: underline; }

@media (max-width: 360px) {
  .up .t { font-size: 9.5px; }
}
