:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-deep: #0a0f15;
  --accent: #ffd700;
  --text: #e8edf2;
  --text-dim: #8b9bb0;
  --win: #4ade80;
  --neutral: #fbbf24;
  --loss: #f87171;
  --border: #2a3a52;
  --primary: linear-gradient(135deg, #ff6b35, #f72585);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: radial-gradient(circle at top left, rgba(255, 107, 53, 0.12), transparent 22rem), var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.container {
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 2px 0 4px;
}
.page-title {
  min-width: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-btn {
  min-width: 58px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 11px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.nav-btn:active { transform: scale(0.97); }

.balance-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.balance-label {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.balance-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-top: 4px;
}
.balance-sub {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 4px;
}
.balance-pill {
  border: 1px solid rgba(74, 222, 128, 0.36);
  color: var(--win);
  background: rgba(74, 222, 128, 0.08);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.balance-stack {
  display: grid;
  gap: 4px;
  min-width: 136px;
}
.balance-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: var(--text-dim);
}
.balance-row b {
  color: var(--text);
  font-size: 11px;
}
.balance-row.primary {
  align-items: baseline;
  margin-bottom: 1px;
}
.balance-row.primary span {
  color: #a7c7ff;
  font-size: 10px;
  font-weight: 800;
}
.balance-row.primary b {
  color: var(--text);
  font-size: 14px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 2px 0;
  margin-top: 4px;
}
.section-title .sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.75;
}

.shop-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }

.shop-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 12px 12px 10px;
}
.shop-card.material-card {
  grid-template-columns: 52px 1fr 132px;
  align-items: start;
}
.card-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-deep);
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 24px;
}
.card-info { min-width: 0; }
.card-amount {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}
.card-amount .unit {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 700;
  margin-left: 3px;
}
.card-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 5px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buy-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  min-width: 92px;
  min-height: 36px;
}
.buy-btn:active { transform: scale(0.97); }
.buy-btn.cant {
  background: var(--bg-deep);
  color: var(--loss);
  opacity: 0.7;
  border: 1px solid var(--border);
}
.buy-btn.gold-buy {
  width: 92px;
  justify-self: end;
}
.buy-btn.material-buy {
  padding: 8px 14px;
}

.buy-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.buy-panel.compact { gap: 7px; }
.qty-stepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 6px;
}
.qty-stepper.inline {
  width: 132px;
}
.qty-tools {
  grid-column: 3;
  align-self: start;
  display: grid;
  justify-items: end;
}
.qty-value {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}
.qty-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}
.qty-btn {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.qty-btn:active { transform: scale(0.97); }
.qty-row.plus .qty-btn { color: var(--win); }
.qty-row.minus .qty-btn { color: var(--loss); }
.qty-btn.reset { color: var(--text-dim); }
.avatar-card .avatar-icon {
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.32), transparent 18px),
    var(--bg-deep);
}

.purchase-icon {
  font-size: 56px;
  animation: purchasePop 0.32s ease;
}
@keyframes purchasePop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.shop-card.cyan .card-icon { color: #38bdf8; }
.shop-card.gold .card-icon { color: var(--accent); }
.shop-card.violet .card-icon { color: #a78bfa; }
.shop-card.fire .card-icon { color: #ff6b35; }
.shop-card.green .card-icon { color: var(--win); }

.shop-foot {
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  opacity: 0.65;
  margin-top: 8px;
  padding: 0 12px;
  line-height: 1.5;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.18s ease;
}
.overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 320px;
  background: var(--bg-card);
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  border: 1px solid var(--border);
}

.soon-icon { font-size: 48px; }
.soon-title {
  font-size: 20px;
  font-weight: 800;
  margin: 14px 0 8px;
  color: var(--text);
}
.soon-sub {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 18px;
}
.close-btn {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.close-btn:active { transform: scale(0.98); }

/* ===== 이지 디파짓 버튼 ===== */
.deposit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #0098ea 0%, #0077c2 100%);
  border: 1px solid rgba(0, 152, 234, 0.35);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 152, 234, 0.22);
  transition: transform 0.12s, box-shadow 0.12s;
}
.deposit-btn:active { transform: scale(0.985); box-shadow: 0 4px 12px rgba(0, 152, 234, 0.18); }
.deposit-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  font-size: 22px;
}
.deposit-copy { flex: 1; min-width: 0; text-align: left; }
.deposit-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0.80;
  text-transform: uppercase;
}
.deposit-title {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.2;
  margin-top: 2px;
}
.deposit-arrow { font-size: 20px; opacity: 0.70; flex: 0 0 auto; }
