/* ============================================================
   SAI / 모두레이터 — 다크 네이비 + 비비드 블루 글로우
   Display: Fraunces 안 씀. 한글 SaaS 톤 → Pretendard 중심 + 무게 대비
   ============================================================ */
:root {
  --bg: #070b1a;
  --bg-2: #0b1124;
  --panel: #0f1730;
  --panel-2: #131c3a;
  --panel-3: #18234a;
  --line: rgba(120, 150, 220, .14);
  --line-2: rgba(120, 150, 220, .26);
  --txt: #eaf0ff;
  --txt-2: #9fb0d8;
  --txt-3: #5f6f9a;
  --blue: #3f7bff;
  --blue-2: #5b93ff;
  --cyan: #38d6ff;
  --glow: rgba(63, 123, 255, .55);
  --green: #36e0a6;
  --amber: #ffb454;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --maxw: 1280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Pretendard", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
em { font-style: normal; color: var(--blue-2); }

/* ===== 다크 테마 커스텀 스크롤바 (전역) ===== */
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: rgba(91,147,255,.32) transparent; }
/* WebKit (Chrome/Safari/Edge) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--blue), rgba(63,123,255,.35));
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(var(--blue-2), var(--blue));
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

/* 배경 글로우 레이어 */
.bg-fx {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% -5%, rgba(63,123,255,.22), transparent 60%),
    radial-gradient(40% 40% at 85% 20%, rgba(56,214,255,.10), transparent 55%),
    radial-gradient(50% 50% at 10% 80%, rgba(63,123,255,.10), transparent 55%),
    var(--bg);
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(120,150,220,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,150,220,.05) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(75% 60% at 50% 30%, #000, transparent 90%);
  mask-image: radial-gradient(75% 60% at 50% 30%, #000, transparent 90%);
}

/* ===================== 상단 네비 ===================== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(18px, 4vw, 48px);
  background: rgba(7, 11, 26, .72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(145deg, var(--blue), var(--cyan));
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 17px;
  box-shadow: 0 0 18px var(--glow);
}
.logo b { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.nav-links { display: flex; gap: 4px; }
.nav-link { font-size: 14px; color: var(--txt-2); padding: 9px 16px; border-radius: 10px; transition: all .18s; font-weight: 500; }
.nav-link:hover { color: var(--txt); background: var(--panel-2); }
.nav-link.active { color: #fff; background: var(--panel-3); }
.login-btn { border: 1px solid var(--line-2); padding: 9px 18px; border-radius: 10px; font-size: 14px; color: var(--txt); transition: all .18s; }
.login-btn:hover { border-color: var(--blue); box-shadow: 0 0 16px var(--glow); }

/* ===================== 뷰 전환 ===================== */
.view { display: none; animation: fade .5s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===================== 마스코트 ===================== */
.mascot {
  width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 30px;
  background: linear-gradient(155deg, #1b2a55, #0e1730);
  border: 1px solid var(--line-2);
  display: grid; place-items: center; position: relative;
  box-shadow: 0 0 40px var(--glow), inset 0 0 20px rgba(63,123,255,.18);
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.mascot::before { /* 얼굴 */
  content: ""; width: 40px; height: 28px; border-radius: 14px;
  background: #0a1024; border: 1.5px solid var(--line-2);
}
.mascot .eye { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); top: 35px; box-shadow: 0 0 10px var(--cyan); animation: blinkEye 4s infinite; }
.mascot .eye.l { left: 26px; } .mascot .eye.r { right: 26px; }
@keyframes blinkEye { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

/* ===================== 랜딩 ===================== */
.hero { max-width: 860px; margin: 0 auto; padding: clamp(56px, 10vh, 110px) 24px 60px; text-align: center; }
.hero h1 { font-size: clamp(36px, 6vw, 68px); font-weight: 800; line-height: 1.12; letter-spacing: -.03em; margin-bottom: 22px; }
.hero h1 em { position: relative; }
.hero-sub { font-size: clamp(15px, 1.7vw, 19px); color: var(--txt-2); line-height: 1.65; margin-bottom: 40px; max-width: 560px; margin-left: auto; margin-right: auto; }

.searchbar {
  display: flex; align-items: center; gap: 10px; max-width: 680px; margin: 0 auto;
  background: var(--panel); border: 1.5px solid var(--line-2); border-radius: 100px;
  padding: 9px 9px 9px 26px; transition: border .2s, box-shadow .2s;
}
.searchbar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(63,123,255,.15), 0 0 40px var(--glow); }
.searchbar input { flex: 1; border: none; background: none; outline: none; font-size: 16px; color: var(--txt); font-family: inherit; }
.searchbar input::placeholder { color: var(--txt-3); }
.searchbar .go {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(145deg, var(--blue), var(--blue-2)); color: #fff; font-size: 20px;
  display: grid; place-items: center; transition: all .2s; box-shadow: 0 0 18px var(--glow);
}
.searchbar .go:hover { transform: scale(1.06); }

.suggest { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 24px; }
.suggest button {
  font-size: 13.5px; color: var(--txt-2); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 100px; transition: all .18s; background: rgba(255,255,255,.02);
}
.suggest button:hover { border-color: var(--blue); color: var(--txt); background: var(--panel-2); }

.hero-foot { margin-top: 46px; font-size: 12.5px; color: var(--txt-3); letter-spacing: .04em; }
.hero-foot span { margin: 0 10px; }

/* 신뢰 지표 */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 5vw, 48px) 20px; }
.trust-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; text-align: center; }
.trust-num { font-size: clamp(26px, 3.6vw, 40px); font-weight: 800; letter-spacing: -.02em; background: linear-gradient(120deg, #fff, var(--blue-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.trust-num .unit { font-size: 15px; -webkit-text-fill-color: var(--txt-2); }
.trust-label { font-size: 13px; color: var(--txt-2); margin-top: 6px; }

/* 섹션 */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(48px, 7vw, 80px) clamp(18px, 5vw, 48px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 30px; flex-wrap: wrap; gap: 12px; }
.section-head h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 700; letter-spacing: -.02em; }
.section-head .more { font-size: 14px; color: var(--blue-2); font-weight: 600; }

/* 카테고리 그리드 */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; cursor: pointer; transition: all .22s; position: relative; overflow: hidden;
}
.cat-card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 100% 0%, rgba(63,123,255,.14), transparent 60%); opacity: 0; transition: opacity .22s; }
.cat-card:hover { transform: translateY(-4px); border-color: var(--blue); box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.cat-card:hover::after { opacity: 1; }
.cat-card .ct-count { font-size: 32px; font-weight: 800; color: var(--blue-2); line-height: 1; }
.cat-card .ct-label { font-size: 15.5px; font-weight: 600; margin-top: 12px; }
.cat-card .ct-sub { font-size: 12px; color: var(--txt-3); margin-top: 3px; }

/* ===================== 대화(SAI) ===================== */
/* 채팅 모드: 페이지 전체를 뷰포트에 고정, 내부 패널만 스크롤 */
body.chat-mode { overflow: hidden; }
body.chat-mode footer { display: none; }
.chat-wrap { display: grid; grid-template-columns: 1.05fr .95fr; max-width: var(--maxw); margin: 0 auto; height: calc(100vh - 64px); height: calc(100dvh - 64px); min-height: 0; }
.chat-side { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.chat-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px clamp(18px, 3vw, 34px); border-bottom: 1px solid var(--line); }
.chat-bar .title { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; }
.bot-dot { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(145deg, var(--blue), var(--cyan)); display: grid; place-items: center; font-size: 13px; box-shadow: 0 0 14px var(--glow); }
.chat-bar .sub { font-size: 12px; color: var(--txt-3); font-weight: 400; }
.ghost-btn { font-size: 13px; color: var(--txt-2); border: 1px solid var(--line); padding: 7px 14px; border-radius: 100px; transition: all .18s; }
.ghost-btn:hover { border-color: var(--blue); color: var(--txt); }

.thread { flex: 1; overflow-y: auto; min-height: 0; padding: 26px clamp(18px, 3vw, 34px); display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 88%; line-height: 1.62; font-size: 15px; animation: pop .35s ease backwards; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; background: linear-gradient(145deg, var(--blue), var(--blue-2)); color: #fff; padding: 12px 17px; border-radius: 16px 16px 5px 16px; box-shadow: 0 4px 18px rgba(63,123,255,.3); }
.msg.sai { align-self: flex-start; display: flex; gap: 10px; }
.msg.sai .bot-dot { flex-shrink: 0; margin-top: 2px; }
.msg.sai .bubble { background: var(--panel); border: 1px solid var(--line); padding: 13px 17px; border-radius: 5px 16px 16px 16px; }
.msg.sai .body { white-space: pre-wrap; }
.msg.sai .body strong { font-weight: 700; color: #fff; }

.intent-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.intent-chips button { font-size: 13px; border: 1px solid var(--blue); color: var(--blue-2); padding: 8px 14px; border-radius: 100px; transition: all .18s; }
.intent-chips button:hover { background: var(--blue); color: #fff; }

.typing { display: inline-flex; gap: 5px; padding: 3px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-2); animation: blink 1.2s infinite both; }
.typing span:nth-child(2){animation-delay:.2s}.typing span:nth-child(3){animation-delay:.4s}
@keyframes blink { 0%,80%,100%{opacity:.25} 40%{opacity:1} }

.composer { display: flex; gap: 10px; padding: 16px clamp(18px, 3vw, 34px) 22px; border-top: 1px solid var(--line); }
.composer input { flex: 1; border: 1.5px solid var(--line); background: var(--panel); border-radius: 100px; padding: 13px 20px; font-size: 15px; font-family: inherit; outline: none; color: var(--txt); transition: border .2s; }
.composer input::placeholder { color: var(--txt-3); }
.composer input:focus { border-color: var(--blue); }
.composer button { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(145deg, var(--blue), var(--blue-2)); color: #fff; font-size: 19px; flex-shrink: 0; transition: all .2s; box-shadow: 0 0 16px var(--glow); }
.composer button:hover { transform: scale(1.05); }

/* 추천 카드 패널 */
.rec-side { overflow-y: auto; overflow-x: hidden; background: var(--bg-2); padding: 18px clamp(16px, 2.5vw, 30px) 50px; scroll-padding-top: 56px; }
.rec-head { position: sticky; top: 0; z-index: 3; padding: 10px 2px 14px;
  background: var(--bg-2);
  display: flex; align-items: baseline; justify-content: space-between; }
/* 헤더 아래 부드러운 페이드 — 카드가 헤더로 빨려들듯 사라지게 */
.rec-head::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px;
  background: linear-gradient(var(--bg-2), transparent); pointer-events: none; }
.rec-head .t { font-weight: 700; font-size: 17px; }
.rec-head .h { font-size: 12px; color: var(--txt-3); }
.rec-empty { color: var(--txt-3); font-size: 14px; line-height: 1.7; padding: 50px 8px; text-align: center; }
.rec-list { display: flex; flex-direction: column; gap: 12px; }

/* 멀티 의도 그룹 추천 */
.rec-group { margin-bottom: 20px; }
.rec-group-title { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 2px 10px; }
.rec-group-title span { font-size: 14px; font-weight: 700; color: var(--blue-2); }
.rec-group-title b { font-size: 11.5px; color: var(--txt-3); font-weight: 500; }
.rec-group-list { display: flex; flex-direction: column; gap: 10px; }

/* ===================== 솔루션 카드 ===================== */
.scard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; position: relative; cursor: pointer; display: flex; gap: 14px;
  transition: transform .2s, box-shadow .2s, border-color .2s; animation: pop .45s ease backwards;
}
.scard:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 16px 40px rgba(0,0,0,.45); }
.scard.rec { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), 0 10px 30px rgba(63,123,255,.18); }
.scard.rec::before { content: "추천"; position: absolute; top: -9px; left: 14px; background: linear-gradient(145deg,var(--blue),var(--blue-2)); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 100px; box-shadow: 0 0 12px var(--glow); }

/* 매칭 점수 링 */
.fit-ring { width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; position: relative; }
.fit-ring .pct { font-size: 12px; font-weight: 800; }
.fit-ring .lbl { position: absolute; bottom: -14px; font-size: 8.5px; color: var(--txt-3); white-space: nowrap; }
.scard-main { flex: 1; min-width: 0; }
.scard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.scard-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.scard-like { font-size: 11.5px; color: var(--txt-3); white-space: nowrap; }
.scard-org { font-size: 12px; color: var(--txt-3); margin: 2px 0 9px; }
.scard-sum { font-size: 13px; line-height: 1.5; color: var(--txt-2); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scard-foot { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.chip-cat { font-size: 10.5px; color: var(--blue-2); background: rgba(63,123,255,.12); padding: 3px 9px; border-radius: 100px; }
.chip-tag { font-size: 10.5px; color: var(--txt-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 100px; }
.tier { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 100px; }
.tier.strong { color: var(--green); background: rgba(54,224,166,.12); }
.tier.usable { color: var(--cyan); background: rgba(56,214,255,.12); }
.tier.unverified { color: var(--txt-3); border: 1px solid var(--line); }
.tier.review, .tier.weak { color: var(--amber); background: rgba(255,180,84,.12); }

/* ===================== 탐색 ===================== */
.browse-head { max-width: var(--maxw); margin: 0 auto; padding: clamp(36px, 5vw, 56px) clamp(18px, 5vw, 48px) 0; }
.browse-head h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.browse-head p { color: var(--txt-2); font-size: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; max-width: var(--maxw); margin: 0 auto; padding: 26px clamp(18px, 5vw, 48px) 0; }
.filter-chip { font-size: 13px; color: var(--txt-2); border: 1px solid var(--line); padding: 9px 15px; border-radius: 100px; background: var(--panel); transition: all .18s; }
.filter-chip:hover { border-color: var(--blue); color: var(--txt); }
.filter-chip.active { background: linear-gradient(145deg,var(--blue),var(--blue-2)); color: #fff; border-color: transparent; box-shadow: 0 0 16px var(--glow); }
.sort-sel { margin-left: auto; }
.sort-sel select { font-family: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 100px; padding: 9px 15px; background: var(--panel); color: var(--txt-2); cursor: pointer; }
.browse-grid { max-width: var(--maxw); margin: 0 auto; padding: 26px clamp(18px, 5vw, 48px) 80px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* ===================== 상세 모달 ===================== */
.modal-bg { position: fixed; inset: 0; z-index: 1000; background: rgba(3,6,16,.7); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 24px; animation: fade .25s ease; }
.modal-bg.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 40px 100px rgba(0,0,0,.6); animation: rise .35s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.modal-head { padding: 30px 32px 22px; border-bottom: 1px solid var(--line); position: relative; }
.modal-close { position: absolute; top: 22px; right: 24px; font-size: 20px; color: var(--txt-3); width: 34px; height: 34px; border-radius: 50%; transition: all .18s; }
.modal-close:hover { background: var(--panel-3); color: var(--txt); }
.modal-name { font-size: 26px; font-weight: 800; letter-spacing: -.02em; padding-right: 40px; }
.modal-org { font-size: 14px; color: var(--txt-3); margin-top: 6px; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.modal-body { padding: 26px 32px 32px; }
.modal-sec { margin-bottom: 24px; }
.modal-sec h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--txt-3); margin-bottom: 10px; font-weight: 700; }
.modal-desc { font-size: 14.5px; line-height: 1.75; color: var(--txt-2); white-space: pre-wrap; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.price-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.price-row .pl { color: var(--txt-2); }
.price-row .pp { font-weight: 700; }
.modal-cta { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.btn-primary { background: linear-gradient(145deg,var(--blue),var(--blue-2)); color: #fff; font-weight: 600; font-size: 15px; padding: 14px 24px; border-radius: 100px; box-shadow: 0 0 18px var(--glow); transition: transform .2s; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border: 1.5px solid var(--line-2); color: var(--txt); font-weight: 600; font-size: 15px; padding: 13px 22px; border-radius: 100px; transition: all .2s; }
.btn-ghost:hover { border-color: var(--blue); }
.sibling { font-size: 13px; color: var(--blue-2); cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 100px; transition: all .18s; }
.sibling:hover { border-color: var(--blue); }

footer { border-top: 1px solid var(--line); padding: 28px clamp(18px,5vw,48px); text-align: center; font-size: 12.5px; color: var(--txt-3); }

@media (max-width: 900px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-side { min-height: 60vh; }
  .trust { grid-template-columns: repeat(2, 1fr); }
}
