
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f7f7f9;
  color: #222;
}
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e6e6ef;
  position: sticky;
  top: 0;
}
h1 { margin: 0; font-size: 18px; font-weight: 700; }
.palette {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  background: #f0f0f5;
  border-radius: 10px;
}
.color-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 2px solid #fff; outline: 2px solid transparent;
  cursor: pointer;
}
.color-btn.active { outline: 2px solid #333; }
.info { margin-left: auto; display: flex; align-items: center; gap: 10px; }
#creditsBadge { background: #eef2ff; padding: 6px 10px; border-radius: 10px; }
.pay { padding: 6px 10px; border: 0; background: #111; color: #fff; border-radius: 8px; cursor: pointer; }
main {
  display: grid; place-items: center;
  padding: 16px;
}
#board {
  background: #fff;
  border: 2px solid #e2e2ec;
  border-radius: 12px;
  box-shadow: 0 1px 10px rgba(0,0,0,0.06);
}
footer {
  text-align: center;
  padding: 10px 0 20px;
  color: #666;
}
/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;               /* 헤더보다 위 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;               /* 작은 화면 여백 */
}

.modal-panel {
  width: min(560px, 92vw);
  max-height: 90vh;            /* 화면보다 커지지 않게 */
  overflow-y: auto;            /* 내용 스크롤 */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.modal-header {
  position: sticky; top: 0;    /* 닫기 버튼 항상 보이게 */
  background: inherit;
  z-index: 1;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex; align-items: center; justify-content: space-between;
}
/* 버튼 */
.btn-primary {
  padding: 10px 14px; border-radius: 10px; border: 0; cursor: pointer;
  background: #111; color: #fff; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.btn-primary:disabled { opacity:.5; cursor:not-allowed; }

/* 모달 */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  width: 420px; background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
}
.modal-head, .modal-foot {
  padding: 14px 16px; background: #f7f7f8; display:flex; align-items:center; justify-content:space-between;
}
.modal-body { padding: 16px; }
.row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:10px 0; }
.row input[type="number"] { width: 120px; }
.price-line { display:flex; align-items:center; justify-content:flex-end; gap:10px; margin-top:10px; font-size:18px; }
.hint { color:#666; font-size:12px; margin-top:10px; }
.icon-btn { background: transparent; border:0; font-size:18px; cursor:pointer; }
body {
  overflow-y: auto; /* 세로 스크롤 활성화 */
  overflow-x: hidden; /* 가로 스크롤은 필요 없으면 숨김 */
}
.paypal-pay-btn {
  margin-top: 12px;
  padding: 10px 16px;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  border: 0; border-radius: 8px; cursor: pointer;
  background: #0070ba; color: #fff;
}
.paypal-pay-btn:hover { background: #005c99; }


.modal-body { padding: 16px; }

/* 모바일 풀스크린 시트 */
@media (max-width: 640px) {
  .modal-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}


/* 모달 열릴 때 배경 스크롤만 막기 */
body.modal-open { overflow: hidden; }
