/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: 'DM Sans', 'Pretendard', system-ui, sans-serif;

  /* ── Surfaces ────────────────────────────────────────────────────────── */
  --white:        #ffffff;
  --bg:           #f8faff;
  --border:       #dbeafe;
  --border-light: #eff6ff;

  /* ── Slate — crisp cool grays ────────────────────────────────────────── */
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #1e293b;
  --slate-800: #0f172a;   /* 딥 네이비 — primary text */

  /* ── Navy Blue (replaces violet) ─────────────────────────────────────── */
  --violet-50:  #eff6ff;   /* blue-50  */
  --violet-100: #dbeafe;   /* blue-100 */
  --violet-200: #bfdbfe;   /* blue-200 */
  --violet-400: #60a5fa;   /* blue-400 */
  --violet-500: #3b82f6;   /* blue-500 */
  --violet-600: #1d4ed8;   /* blue-700 — CTA bg, icons */
  --violet-700: #1e3a8a;   /* blue-900 — active text   */

  /* ── Amber — premium tier ────────────────────────────────────────────── */
  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --orange-500: #f97316;
  --orange-600: #ea580c;

  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-600: #059669;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-400: #f87171;
  --red-500: #ef4444;

  --blue-500: #3b82f6;

  /* ── Shadows ─────────────────────────────────────────────────────────── */
  --shadow-sm: 0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,.09), 0 2px 6px rgba(15,23,42,.05);
  --shadow-xl: 0 16px 48px rgba(15,23,42,.10), 0 4px 16px rgba(15,23,42,.06);
  --shadow-violet: 0 4px 14px rgba(29,78,216,.20);
  --shadow-amber:  0 4px 14px rgba(245,158,11,.18);

  /* ── Layout ──────────────────────────────────────────────────────────── */
  --layout-max-w: 1100px;
  --layout-px:    24px;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--slate-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248,250,255,.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}
.header-inner {
  max-width: var(--layout-max-w);
  margin: 0 auto;
  padding: 12px var(--layout-px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-icon { display: block; flex-shrink: 0; }
.logo-text { line-height: 1; }
.logo-name {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--slate-800);
}
.logo-name span { color: var(--violet-600); }
.logo-sub {
  font-size: .58rem;
  color: var(--slate-400);
  margin-top: 3px;
  display: block;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* 언어 전환 */
.lang-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.lang-link {
  font-size: .72rem;
  font-weight: 600;
  color: var(--slate-400);
  text-decoration: none;
  padding: 3px 7px;
  border-radius: 5px;
  transition: color .15s, background .15s;
}
.lang-link:hover  { color: var(--slate-600); }
.lang-link.active { color: var(--violet-700); background: var(--violet-50); }
.lang-sep { color: var(--slate-300); font-size: .7rem; }

/* 인증 영역 */
.header-auth { flex-shrink: 0; }
.auth-guest, .auth-user { display: flex; align-items: center; gap: 8px; }

/* 관리자 배지 */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 5px 10px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s;
}
.admin-badge:hover { filter: brightness(.93); }

/* 로그인 버튼 */
.btn-login {
  font-size: .78rem;
  font-weight: 600;
  color: var(--violet-700);
  background: var(--violet-50);
  border: 1px solid var(--violet-200);
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-login:hover { background: var(--violet-100); border-color: var(--violet-400); }

/* 크레딧 표시 + 충전 통합 버튼 */
.credit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--slate-100);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 10px 6px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.credit-btn:hover {
  background: var(--violet-50);
  border-color: var(--violet-200);
  box-shadow: var(--shadow-sm);
}
.credit-icon   { font-size: .85rem; }
.credit-amount { font-size: .8rem; font-weight: 700; color: var(--violet-600); font-family: monospace; }
.credit-label  { font-size: .7rem; color: var(--slate-400); }
.credit-plus {
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  background: var(--violet-600);
  border-radius: 5px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  flex-shrink: 0;
}

/* ── 프로필 드롭다운 ───────────────────────────────────────────────────────── */
.profile-wrap {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--slate-200);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.profile-trigger:hover {
  background: var(--slate-100);
  border-color: var(--slate-300);
}

/* 원형 아바타 — 이미지 */
.profile-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
/* 원형 아바타 — 이니셜 fallback */
.profile-avatar-init {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  background: var(--violet-600);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  line-height: 1;
}

.profile-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--slate-700);
  max-width: 72px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-caret {
  color: var(--slate-400);
  transition: transform .2s;
  flex-shrink: 0;
}
.profile-wrap.open .profile-caret {
  transform: rotate(180deg);
}

/* 드롭다운 패널 */
.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  overflow: hidden;
  z-index: 200;
}
.profile-wrap.open .profile-dropdown {
  display: block;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--slate-600);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.profile-menu-item:hover {
  background: var(--slate-100);
  color: var(--slate-800);
}
.profile-menu-logout {
  color: var(--slate-500);
}
.profile-menu-logout:hover {
  color: #dc2626;
  background: var(--red-50);
}

/* ── Hero section ─────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 52px 24px 38px;
  max-width: 640px;
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1.05;
  white-space: nowrap;
  background: linear-gradient(105deg,
    #1e3a8a 0%,
    #1e3a8a 12%,
    #1d4ed8 25%,
    #3b82f6 38%,
    #93c5fd 48%,
    #eff6ff 50%,
    #93c5fd 52%,
    #3b82f6 62%,
    #1d4ed8 75%,
    #1e3a8a 88%,
    #1e3a8a 100%);
  background-size: 400% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 9s cubic-bezier(.4,0,.2,1) infinite;
  margin-bottom: 18px;
}
@keyframes titleShimmer {
  0%   { background-position: 0% 0; }
  68%  { background-position: 0% 0; }
  86%  { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}
.hero-roi {
  display: block;
  margin: 0 0 16px;
  font-size: .97rem;
  font-weight: 700;
  color: var(--violet-700);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #eff6ff 100%);
  background-size: 200% 200%;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 18px 22px;
  line-height: 1.95;
  word-break: keep-all;
  text-align: center;
  letter-spacing: -.01em;
  animation: roiGlow 5s ease infinite;
}
@keyframes roiGlow {
  0%   { background-position: 0% 50%;   box-shadow: 0 2px 10px rgba(29,78,216,.07); }
  50%  { background-position: 100% 50%; box-shadow: 0 6px 24px rgba(29,78,216,.16); }
  100% { background-position: 0% 50%;   box-shadow: 0 2px 10px rgba(29,78,216,.07); }
}
.hero-roi-accent {
  display: block;
  margin-top: 6px;
  color: var(--violet-600);
  font-weight: 700;
}
.hero-desc {
  font-size: .9rem;
  color: var(--slate-500);
  line-height: 1.75;
  word-break: keep-all;
}
.hero-disclaimer {
  margin-top: 10px;
  font-size: .72rem;
  color: var(--slate-400);
  line-height: 1.6;
  word-break: keep-all;
}

/* ── Main layout ──────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: var(--layout-max-w);
  margin: 0 auto;
  width: 100%;
  padding: 32px var(--layout-px);
}
.layout-cols {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
}
.center-col { flex: 1; min-width: 0; }

/* ── Ad banners (siderail) ────────────────────────────────────────────────── */
.ad-banner {
  width: 160px;
  flex-shrink: 0;
  padding: 8px 0;
  align-self: flex-start;
  min-height: 250px;
}
.ad-banner ins { width: 100%; }

/* ── Bottom ad bar (multiplex) ───────────────────────────────────────────── */
.bottom-ad { border-top: 1px solid var(--border-light); padding: 12px 0; }
.bottom-ad-inner {
  max-width: var(--layout-max-w); margin: 0 auto; padding: 0 var(--layout-px);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border-light); background: var(--white); padding: 20px 24px; }
.footer-inner {
  max-width: var(--layout-max-w); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.footer-copy { font-size: .7rem; color: var(--slate-400); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: .7rem; color: var(--slate-400); text-decoration: none; transition: color .15s; }
.footer-links a:hover { color: var(--violet-600); }
.footer-biz {
  width: 100%;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.footer-biz-name {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--slate-600);
  margin-bottom: 4px;
  letter-spacing: -.01em;
}
.footer-biz-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: .67rem;
  color: var(--slate-500);
  line-height: 1.9;
}
.footer-biz-sep { color: var(--slate-300); margin: 0 8px; }
.footer-biz-disclaimer {
  margin-top: 6px;
  font-size: .62rem;
  color: var(--slate-400);
  line-height: 1.75;
  word-break: keep-all;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1080px) { :root { --layout-px: 20px; } }
@media (max-width: 900px)  { .ad-banner { display: none; } .header-tagline { display: none; } }
@media (max-width: 640px) {
  :root { --layout-px: 16px; }
  .header-inner { gap: 10px; }
  .logo-sub     { display: none; }
  .credit-label { display: none; }
  .credit-btn   { padding: 5px 8px; }
  .btn-logout   { padding: 6px 9px; font-size: .7rem; }
}
@media (max-width: 400px) {
  .lang-nav { display: none; }
  main      { padding: 16px var(--layout-px); }
}

@media (max-width: 560px) {
  body { overflow-x: hidden; }

  .header-inner {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 10px;
  }
  .logo {
    min-width: 0;
    max-width: calc(100% - 88px);
  }
  .logo-name { font-size: .9rem; }
  .lang-nav { margin-left: 0; }

  .header-auth {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
  .auth-user,
  .auth-guest {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }

  .profile-name { display: none; }
  .profile-trigger { padding: 4px 8px 4px 4px; }
  .profile-dropdown { min-width: 132px; }

  .hero {
    padding: 32px 16px 26px;
  }
  .hero-title {
    white-space: normal;
    font-size: clamp(2.1rem, 10vw, 2.8rem);
    line-height: 1.1;
    margin-bottom: 14px;
  }
  .hero-roi,
  .hero-desc {
    font-size: .8rem;
    line-height: 1.7;
  }
  .hero-disclaimer {
    font-size: .68rem;
  }

  main {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .bottom-ad-inner { padding: 10px var(--layout-px); }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
}

@media (max-width: 400px) {
  .lang-nav { display: flex; }
  .header-inner { gap: 8px; }
  .logo { max-width: calc(100% - 76px); }
  .lang-link { padding: 3px 6px; }
  .credit-amount { font-size: .75rem; }
  .credit-plus {
    width: 16px;
    height: 16px;
    font-size: .7rem;
  }
  main { padding: 16px var(--layout-px); }
}
