/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5);
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn--sm { min-height: 34px; padding: 0 var(--space-3); font-size: 13px; }
.btn--block { width: 100%; }
.btn.is-disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid transparent; border-radius: var(--radius-s);
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }

/* ---------- 폼 ---------- */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field__label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field__input {
  width: 100%; min-height: 44px; padding: 0 var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink);
}
.field__input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field__hint { font-size: 12px; color: var(--muted); margin: 0; }
.field__error { font-size: 12px; color: var(--critical); margin: 0; }
.field.is-invalid .field__input { border-color: var(--critical); }

/* ---------- 알림 · 배지 ---------- */
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-s); margin: 0; }
.alert--critical { background: var(--critical-soft); color: var(--critical); }
.alert--info { background: var(--info-soft); color: var(--info); }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- 브랜드 ---------- */
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand__mark { width: 30px; height: 30px; flex: 0 0 auto; }
.brand__name { font-size: 22px !important; letter-spacing: -0.02em; white-space: nowrap; }
.brand__eng { color: var(--brand); }
.brand__tag { font-size: 12px; color: var(--muted); }

/* ---------- 아이콘 (Lucide 스프라이트) ---------- */
.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 2; vertical-align: -3px; }
.icon--lg { width: 24px; height: 24px; }
.icon--xl { width: 32px; height: 32px; }
.btn .icon { margin-right: 2px; }

/* ---------- 페이지 공통 ---------- */
.page-head { display: flex; flex-direction: column; gap: 2px; }
.page-head__title { margin: 0; }
.page-head__lead { color: var(--muted); margin: 0; }
.panel { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.panel__title { margin: 0; }
.panel__link { font-size: 13px; }
.empty { color: var(--muted); padding: var(--space-5) 0; text-align: center; margin: 0; }
.error-page { text-align: center; padding: var(--space-8) 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }

/* ---------- 통계 · 퀵 링크 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.stat__label { font-size: 12px; color: var(--muted); }
.stat__value { font-size: 20px; font-weight: 700; }
.stat__value small { font-size: 12px; font-weight: 400; color: var(--muted); }
.stat__note { font-size: 12px; color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
.quick { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.quick__icon { grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent-ink); }
.quick__title { font-weight: 500; }
.quick__desc { font-size: 12.5px; color: var(--muted); }
.quick:hover .quick__title { color: var(--accent-ink); }

@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface); }
  .panel { padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface); }
  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick { padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-s); }
  .quick:hover { border-color: var(--accent); }
}

/* ===== 모달 (로그인 · 구매) ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: var(--space-4); background: rgba(8, 8, 10, .55); }
.modal__box { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; padding: var(--space-5); border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal--wide .modal__box { max-width: 720px; }
.modal__close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.modal__close:hover { background: var(--bg); color: var(--ink); }
.modal__title { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.02em; }
.modal__lead { margin: 0 0 var(--space-4); font-size: 13.5px; color: var(--muted); }
.modal-form { display: grid; gap: var(--space-3); }
.btn--block { width: 100%; justify-content: center; }
.tabs { display: flex; gap: 4px; margin-bottom: var(--space-4); padding: 3px; border-radius: var(--radius-s); background: var(--bg); }
.tabs__tab { flex: 1; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tabs__tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
body.is-modal { overflow: hidden; }
.pkg-grid--modal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pkg--btn { font: inherit; color: inherit; cursor: pointer; }
.pkg--btn:hover:not(:disabled) { border-color: var(--accent); }
.pkg--btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) { .pkg-grid--modal { grid-template-columns: 1fr; } }

/* 크레딧 패키지 카드 (구매 페이지 · 구매 모달) */
.pkg-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.pkg { position: relative; display: grid; gap: 6px; padding: var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-m); background: var(--surface); text-align: center; }
.pkg--featured { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pkg__badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.pkg__name { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.pkg__credits { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.pkg__credits small { font-size: 13px; font-weight: 500; color: var(--muted); }
.pkg__bonus { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.pkg__price { margin-top: 4px; font-size: 18px; font-weight: 700; }
.pkg__price small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.pkg__buy { margin-top: var(--space-2); }
.pkg-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 768px) { .pkg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 목록 공통: 필터 칩 · 요약 dl · 페이저 (프로젝트/공유) */
.summary { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-4); margin: 12px 0; font-size: 13px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-family: var(--font-mono); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.filters__sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.pager { display: flex; gap: 4px; justify-content: center; }
.pager__item { min-width: 32px; padding: 6px; text-align: center; border-radius: var(--radius-s); text-decoration: none; color: var(--muted); }
.pager__item.is-active { background: var(--accent-soft); color: var(--accent-ink); }

/* 칩 (폼 라디오 · 필터 링크) */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13px; color: var(--ink); text-decoration: none; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip:has(input:checked), .chip.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip--ratio[data-ratio="16:9"] .chip__box { width: 20px; height: 11px; }
.chip--ratio[data-ratio="9:16"] .chip__box { width: 11px; height: 20px; }
.chip--ratio[data-ratio="4:3"] .chip__box { width: 20px; height: 15px; }
.chip--ratio[data-ratio="3:4"] .chip__box { width: 15px; height: 20px; }
.chip--ratio[data-ratio="5:4"] .chip__box { width: 20px; height: 16px; }
.chip--ratio[data-ratio="4:5"] .chip__box { width: 16px; height: 20px; }
.chip small { color: var(--muted); font-weight: 400; }
.chip--font { padding: 0 12px; }
.chip--font:has(input:checked) .chip__font { opacity: 1; }
