/* SPL Games Pay - 결제 페이지 스타일 (메인 사이트와 동일 톤) */
@font-face {
  font-family: 'NEXON Lv1 Gothic OTF';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2107@1.1/NEXONLv1GothicOTF.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NEXON Lv1 Gothic OTF';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2107@1.1/NEXONLv1GothicOTFBold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f6f7;
  --bg-2: #f0f2f5;
  --surface: #ffffff;
  --border: #e4e6eb;
  --border-strong: #dadde1;
  --text: #1c1e21;
  --text-dim: #65676b;
  --text-mute: #8a8d91;
  --accent: #0064e0;
  --accent-hover: #0556c9;
  --accent-soft: #e7f0fe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'NEXON Lv1 Gothic OTF', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===== Header ===== */
.pay-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pay-brand { display: inline-flex; align-items: center; }
.pay-brand img { height: 88px; width: auto; }

/* ===== Main ===== */
.pay-main {
  flex: 1;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 16px 16px;
}

/* ===== Landing ===== */
.pay-landing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.pay-landing-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 30px;
}
.pay-landing-card h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.pay-landing-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 14px;
}
.pay-landing-desc {
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.pay-landing-demo {
  padding: 20px;
  margin: 0 0 28px;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 100, 224, 0.2);
  border-radius: var(--radius);
  text-align: left;
}
.pay-landing-demo-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.pay-landing-demo-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--accent);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.pay-landing-demo-game {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.pay-landing-demo-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.pay-landing-demo-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  color: var(--text-mute);
  font-size: 28px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.pay-landing-demo-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pay-landing-demo-meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.pay-landing-demo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  word-break: keep-all;
}
.pay-landing-demo-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pay-landing-demo-price [data-demo-currency] {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.pay-btn-demo {
  margin: 0 !important;
  width: 100% !important;
}
.pay-landing-demo-note {
  font-size: 11px;
  color: var(--text-mute);
  margin: 12px 0 0;
  line-height: 1.5;
  text-align: center;
}

.pay-landing-info {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  text-align: left;
}
.pay-landing-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
}
.pay-landing-info-row .label { color: var(--text-dim); font-weight: 500; }
.pay-landing-info-row .value { color: var(--text); font-weight: 600; }
.pay-landing-info-row .value.link { color: var(--accent); }

/* ===== Checkout Card ===== */
.pay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* === Product === */
.pay-product {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.pay-product-skeleton {
  display: flex;
  gap: 16px;
  align-items: center;
}
.sk {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.sk-icon { width: 72px; height: 72px; border-radius: 16px; flex-shrink: 0; }
.sk-text { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-line { height: 18px; width: 100%; }
.sk-line.short { width: 50%; height: 14px; }

.pay-product[data-state="loaded"] .pay-product-skeleton { display: none; }
.pay-product[data-state="loaded"] .pay-product-content { display: flex !important; }
.pay-product-content {
  display: flex;
  gap: 16px;
  align-items: center;
}
.pay-product-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-2);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.pay-product-icon img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0;
}
.pay-product-icon img[src=""], .pay-product-icon img:not([src]) { display: none; }
.pay-product-icon-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-mute);
  font-size: 36px;
}
.pay-product-icon img[src]:not([src=""]) ~ .pay-product-icon-fallback { display: none; }
.pay-product-info { flex: 1; min-width: 0; }
.pay-product-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}
.pay-product-tag:empty { display: none; }
.pay-product-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  word-break: keep-all;
}
.pay-product-desc {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pay-product-desc:empty { display: none; }
.pay-product-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 6px;
}
.pay-product-price-amount {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.pay-product-price-currency {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
}

/* === Meta (게임/서버/유저) === */
.pay-meta {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.pay-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.pay-meta-row .label {
  color: var(--text-dim);
  font-weight: 500;
}
.pay-meta-row .value {
  color: var(--text);
  font-weight: 600;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}

/* === Verify (본인인증) === */
.pay-verify {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.pay-verify-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pay-verify-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.pay-verify-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.pay-verify[data-state="verified"] .pay-verify-icon {
  background: var(--success-soft);
  color: var(--success);
}
.pay-verify-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.pay-verify-desc {
  font-size: 12px;
  color: var(--text-dim);
}
.pay-btn-verify {
  background: var(--text);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.pay-btn-verify:hover {
  background: #000;
  transform: translateY(-1px);
}
.pay-verify[data-state="verified"] .pay-btn-verify { display: none; }

.pay-verify-done {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.pay-verify-done i { font-size: 18px; }
.pay-verify[data-state="verified"] .pay-verify-done { display: inline-flex; }

/* === 결제하기 버튼 === */
.pay-btn-primary {
  margin: 20px 24px 12px;
  width: calc(100% - 48px);
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 16px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 100, 224, 0.25);
  letter-spacing: -0.01em;
}
.pay-btn-primary i { font-size: 20px; }
.pay-btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 100, 224, 0.35);
}
.pay-btn-primary:disabled {
  background: var(--border-strong);
  color: var(--text-mute);
  cursor: not-allowed;
  box-shadow: none;
}

.pay-notice {
  padding: 0 24px 20px;
  margin: 0;
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.6;
  text-align: center;
}
.pay-notice a { color: var(--accent); text-decoration: underline; }

/* ===== Status Screens (processing, polling, success, fail, error) ===== */
.pay-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.pay-status-card h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.pay-status-card p {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

.pay-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 24px;
  border: 4px solid var(--bg-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pay-status-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 56px;
}
.pay-status-success .pay-status-icon {
  background: var(--success-soft);
  color: var(--success);
}
.pay-status-fail .pay-status-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.pay-result-info {
  margin: 28px 0 20px;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-align: left;
}
.pay-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}
.pay-result-row .label { color: var(--text-dim); }
.pay-result-row .value { font-weight: 600; }
.pay-result-row .value.code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}
.pay-result-note {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 28px;
  line-height: 1.6;
}

.pay-status-card .pay-fail-message {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 36px;
  word-break: keep-all;
}

.pay-fail-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.pay-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pay-btn-secondary:hover {
  background: var(--bg-2);
  border-color: var(--text);
}
.pay-btn-text {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 12px 16px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.pay-btn-text:hover { color: var(--text); }

/* ===== Footer ===== */
.pay-footer {
  padding: 20px 16px 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pay-footer-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.pay-footer-meta {
  font-size: 10px;
  color: var(--text-mute);
  opacity: 0.7;
  letter-spacing: 0.01em;
}
.pay-footer-address {
  font-size: 9.5px;
  color: var(--text-mute);
  opacity: 0.6;
  margin-top: -2px;
}
.pay-footer a { color: var(--text-dim); }
.pay-footer a:hover { color: var(--accent); }
.pay-footer .sep { color: var(--border-strong); }

/* ===== Toast (창 닫기 실패 안내 등) ===== */
.pay-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 30, 33, 0.95);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  animation: pay-toast-in 0.2s ease;
}
@keyframes pay-toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Responsive ===== */
@media (max-width: 420px) {
  .pay-main { padding: 16px 12px 32px; }
  .pay-product { padding: 20px 18px; }
  .pay-meta { padding: 14px 18px; }
  .pay-verify { padding: 16px 18px; }
  .pay-btn-primary { margin: 16px 18px 10px; width: calc(100% - 36px); }
  .pay-notice { padding: 0 18px 18px; }
  .pay-landing-card { padding: 36px 22px; }
  .pay-status-card { padding: 44px 22px; }
  .pay-product-title { font-size: 16px; }
  .pay-product-price-amount { font-size: 20px; }
  .pay-verify-row { flex-wrap: wrap; }
  .pay-btn-verify { width: 100%; padding: 12px 16px; }
}
