/* ============================================================
   케빈스튜디오 / MAF HILLS — 디자인 토큰
   트와일라잇 보라 + 골드 + 라일락
   WCAG 1.4.1 (color + visual indicator) / Pretendard Variable
   ============================================================ */
:root {
  --bg-1: #1a1340;
  --bg-2: #2A1F5C;
  --bg-3: #3E2D8C;
  --bg-base:
    radial-gradient(circle at 30% 20%, rgba(167,139,250,0.18), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(99,102,241,0.14), transparent 55%),
    linear-gradient(180deg, #1B1147 0%, #2A1A66 60%, #1B1147 100%);

  --text:      #FFFFFF;
  --text-soft: #F5F3FF;
  --text-mut:  #C4B5FD;
  --text-dim:  #A78BFA;

  --lilac:      #A78BFA;
  --lilac-soft: #C4B5FD;
  --gold:       #FCD34D;
  --gold-soft:  #FDE68A;
  --gold-deep:  #F59E0B;

  --c-S: #EF4444;
  --c-A: #F59E0B;
  --c-B: #3B82F6;
  --c-C: #1E40AF;
  --c-reserved: #6B7280;
  --c-sold: #3F3756;
  --c-locked: #FCD34D;
  --c-selected: #FBBF24;

  --line:        rgba(196,181,253,.22);
  --panel:       rgba(20,12,55,.55);
  --panel-strong:rgba(20,12,55,.82);
  --panel-line:  rgba(196,181,253,.22);
  --card:        rgba(255,255,255,.06);

  --r:    14px;
  --r-sm: 10px;
  --r-xs: 8px;

  --shadow-1: 0 4px 18px rgba(8,4,30,.45);
  --shadow-2: 0 18px 60px rgba(8,4,30,.55);

  --price-S: 88000;
  --price-A: 77000;
  --price-B: 55000;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
html {
  /* 모바일 over-scroll bounce 시 흰색 노출 방지 — body 그라데이션의 가장 짙은 톤으로 fallback */
  background-color: #1B1147;
  /* 브라우저 기본 UI(스크롤바, autofill, 폼) 다크 컨텍스트 인식 */
  color-scheme: dark;
  /* 모바일 탭 시 흰 사각형 깜빡임 제거 */
  -webkit-tap-highlight-color: rgba(167,139,250,0.18);
}
body {
  /* 단색 fallback — fixed pseudo-element 그라데이션이 paint 못 따라올 때도 흰색 노출 차단 */
  background-color: #1B1147;
  color: var(--text-soft);
  font-family: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', system-ui, sans-serif;
  min-height: 100vh;
  word-break: keep-all;
  overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-feature-settings: "tnum", "ss01";
  /* over-scroll bounce 자체는 살리되, 부모 스크롤로 전파 차단 */
  overscroll-behavior-y: contain;
  position: relative;
}
/* (body::before는 페이지별로 noise grain 등 다양한 용도로 쓸 수 있어 tokens.css에선 정의하지 않음.
   대신 body 자체에 background-color: #1B1147 fallback + html 단색으로 흰색 노출 0 보장.) */

a { color: var(--lilac-soft); text-decoration: none; }
a:hover { color: var(--gold-soft); }

button { font-family: inherit; }

.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px clamp(12px, 2vw, 24px);
}

/* ===== 공통 헤더 ===== */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 10, 40, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-line);
}
.app-header-inner {
  max-width: 1480px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px clamp(12px, 2vw, 24px); gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { width: 40px; height: 40px; flex: none; }
.brand-text { line-height: 1.2; }
.brand-name {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 18px; letter-spacing: 0.02em;
  color: var(--text);
}
.brand-sub {
  font-size: 11px; color: var(--text-mut);
  margin-top: 2px;
}
.head-nav { display: flex; gap: 6px; align-items: center; }
.head-nav a, .head-nav button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-mut);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, color 160ms;
}
.head-nav a:hover, .head-nav button:hover {
  background: rgba(167,139,250,0.14);
  color: var(--text-soft);
}
.head-nav a.primary {
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  color: #1B1147;
  font-weight: 800;
}
.head-nav a.primary:hover { filter: brightness(1.08); }

@media (max-width: 720px) {
  .head-nav a, .head-nav button { padding: 6px 10px; font-size: 12px; }
  .brand-sub { display: none; }
}

/* ===== 공통 푸터 ===== */
.app-footer {
  margin-top: 80px;
  padding: 32px clamp(12px, 2vw, 24px) calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--panel-line);
  background: rgba(15, 10, 40, 0.5);
  font-size: 12px; line-height: 1.7;
  color: var(--text-mut);
}
.app-footer-inner { max-width: 1480px; margin: 0 auto; display: grid; gap: 18px; grid-template-columns: 1fr 1fr 1fr; }
.app-footer h4 {
  margin: 0 0 8px;
  font-size: 12px; font-weight: 700;
  color: var(--gold-soft);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.app-footer .biz-info p { margin: 2px 0; }
.app-footer .biz-info a { color: var(--text-mut); }
.app-footer .legal-list { list-style: none; margin: 0; padding: 0; }
.app-footer .legal-list li { margin: 4px 0; }
.app-footer .copyright {
  grid-column: 1/-1;
  border-top: 1px solid var(--panel-line);
  padding-top: 16px;
  text-align: center;
  font-size: 11px; color: var(--text-dim);
}
@media (max-width: 720px) {
  .app-footer-inner { grid-template-columns: 1fr; }
}

/* ===== 공통 컴포넌트 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--panel-line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-1);
}
.btn {
  appearance: none;
  border: 1px solid rgba(167,139,250,0.35);
  background: rgba(255,255,255,0.04);
  color: var(--text-soft);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  min-height: 44px; min-width: 44px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.btn:hover { background: rgba(167,139,250,0.18); }
.btn-primary {
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  border-color: #F59E0B;
  color: #1B1147;
  font-weight: 800;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); }
.btn-ghost {
  background: transparent;
  border-color: var(--panel-line);
  color: var(--text-mut);
}

.toast-wrap {
  position: fixed; top: 80px; left: 50%;
  transform: translateX(-50%); z-index: 110;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: min(90vw, 420px);
}
.toast {
  background: rgba(15,10,46,0.96);
  border: 1px solid #FCD34D;
  color: #FDE68A;
  padding: 12px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toastIn 200ms ease, toastOut 200ms ease 2.6s forwards;
  pointer-events: auto;
  text-align: center;
}
@keyframes toastIn { from{transform:translateY(-12px); opacity:0;} to{transform:translateY(0); opacity:1;} }
@keyframes toastOut { to{transform:translateY(-12px); opacity:0;} }

.sr-only {
  position: absolute; width:1px; height:1px;
  overflow:hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
