/* 띵픽 — 모바일 우선 · 중성 톤 + 포인트 인디고 */
:root {
  --bg: #f4f5f8;          /* 깔끔한 중성 톤 */
  --bg-soft: #eceef7;     /* 태그/트랙 배경 */
  --card: #ffffff;
  --ink: #2e2f38;
  --ink-soft: #8a8d9b;
  /* 포인트 컬러 (변수명은 유지, 톤만 인디고로) */
  --pink: #8b8df0;
  --pink-deep: #5b5fe3;
  --line: #e7e8ef;
  --shadow: 0 8px 22px rgba(60, 70, 140, 0.12);
  --radius: 18px;
  --maxw: 480px;          /* 모바일 폭 기준 */
  --nav-h: 62px;          /* 하단 네비 높이 */
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* 데스크톱에서도 모바일 폭으로 가운데 정렬 */
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  box-shadow: 0 0 40px rgba(255, 111, 145, 0.06);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 상단 헤더 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 245, 248, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 800; }
.brand-logo { width: 26px; height: 26px; border-radius: 8px; display: block; flex: 0 0 auto; }
.brand .full { font-size: 19px; color: var(--pink-deep); }
.brand .sep { color: #f0c4cc; font-weight: 400; }
.brand .short {
  font-size: 12px; color: #fff; background: var(--pink);
  padding: 2px 8px; border-radius: 999px; font-weight: 700;
}
.icon-btn {
  border: none; background: transparent; font-size: 20px;
  cursor: pointer; color: var(--ink-soft); padding: 6px; line-height: 1;
}
.icon-btn .ico { width: 21px; height: 21px; display: block; }
#searchBtn { color: var(--ink); } /* 검색 돋보기: 검은색 아웃라인 */

/* ---------- 검색 바 ---------- */
.search-bar {
  position: sticky; top: 56px; z-index: 15;
  display: none; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.search-bar.open { display: flex; }
.search-bar .search-ico { color: var(--ink); display: flex; align-items: center; }
.search-bar .search-ico .ico { width: 18px; height: 18px; display: block; }
.search-bar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--ink); padding: 6px 2px;
}
.search-bar .icon-btn { font-size: 16px; }
.search-result-head { padding: 14px 16px 4px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* ---------- 메뉴 서랍 + 백드롭 ---------- */
.backdrop {
  position: fixed; inset: 0;                 /* 전체 화면 덮기 */
  background: rgba(20, 20, 40, 0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 40;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0;
  left: 0; /* 브라우저 창 왼쪽 끝에 붙임(데스크톱에서 좌측 여백 제거) */
  width: 76%; max-width: 290px;
  background: var(--card); z-index: 50;
  box-shadow: 6px 0 30px rgba(60, 70, 140, 0.18);
  transform: translateX(-110%);
  visibility: hidden;                        /* 닫힘 상태를 확실히 숨김(데스크탑 여백 누수 방지) */
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); visibility: visible; transition: transform 0.25s ease; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--line);
}
.drawer-nav { display: flex; flex-direction: column; padding: 8px 0; }
.drawer-nav a {
  padding: 14px 20px; font-size: 16px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--bg-soft);
}
.drawer-nav a:active { background: var(--bg-soft); }
.drawer-nav a.about { color: var(--ink-soft); font-weight: 500; border-bottom: none; margin-top: 6px; }

/* ---------- 배너 ---------- */
.banner {
  margin: 16px 16px 6px;
  border-radius: 22px;
  padding: 32px 22px 30px;
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(130% 130% at 92% 6%, rgba(255, 110, 150, 0.95) 0%, rgba(255, 110, 150, 0) 52%),
    linear-gradient(135deg, #5b5fe3 0%, #7c5cf6 48%, #a84cff 100%);
}
/* 그레인 텍스처 (에디토리얼 무드) */
.banner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.banner > * { position: relative; z-index: 1; }
.banner .b-bean { display: none; }
.banner h2 {
  font-size: 27px; line-height: 1.2; font-weight: 900; letter-spacing: -0.6px;
  text-shadow: 0 2px 14px rgba(20, 16, 60, 0.22);
}
.banner p { font-size: 13px; opacity: 0.92; margin-top: 10px; font-weight: 600; letter-spacing: -0.2px; }

/* ---------- 카테고리 칩 ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 14px 16px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  padding: 8px 15px; border-radius: 999px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.chip.active { background: var(--pink); color: #fff; border-color: var(--pink); }

/* ---------- 섹션 ---------- */
.section { margin-top: 22px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 16px 12px;
}
.section-head h3 { font-size: 17px; }
.section-head .more {
  font-size: 12px; color: var(--ink-soft); cursor: pointer;
  font-weight: 700; padding: 2px 6px; border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.section-head .more:hover { color: var(--pink-deep); background: var(--bg-soft); }
.section-head .more::after { content: " ›"; }
.section.expanded .section-head .more::after { content: " ⌄"; }

/* 가로 스크롤 줄 */
.row {
  display: flex; gap: 13px; overflow-x: auto;
  padding: 2px 16px 6px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
/* 데스크톱: 마우스로 잡아끌기 힌트 */
@media (hover: hover) {
  .row { cursor: grab; }
  .row.dragging { cursor: grabbing; }
}
.row.dragging { scroll-behavior: auto; user-select: none; scroll-snap-type: none; }
.row.dragging a { pointer-events: none; } /* 드래그 중 카드 클릭 방지 */

/* 더보기/전체 펼침: 가로 스크롤 → 그리드로 전부 표시 */
.section.expanded .row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  overflow: visible;
  scroll-snap-type: none;
  cursor: default;
}
.section.expanded .row .tcard { flex: initial; width: auto; }

/* 가로 스크롤 카드 */
.tcard {
  flex: 0 0 168px;
  scroll-snap-align: start;
  cursor: pointer;
}
.tcard .thumb {
  height: 224px; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  position: relative; display: block; transition: transform 0.16s;
}
.tcard:active .thumb { transform: scale(0.97); }
.thumb img { width: 84%; height: 84%; object-fit: contain; display: block; }

/* 포스터형 썸네일: 카드 꽉 채움 + 하단에 제목 오버레이 */
.tcard .thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.poster-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 32px 12px 12px; color: #fff;
  background: linear-gradient(to top, rgba(25, 22, 45, 0.82) 0%, rgba(25, 22, 45, 0.5) 48%, rgba(25, 22, 45, 0) 100%);
}
.poster-title {
  font-size: 14.5px; font-weight: 800; line-height: 1.3; color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.poster-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.poster-meta .pill { background: rgba(255, 255, 255, 0.92); color: var(--pink-deep); font-size: 10.5px; }
.poster-meta .dot-time { color: rgba(255, 255, 255, 0.92); font-size: 11px; }

/* 카드 정보: 카테고리 태그 + 소요시간 */
.card-info { display: flex; align-items: center; gap: 7px; padding: 0 2px; flex-wrap: wrap; }
.pill {
  font-size: 11px; font-weight: 700; color: var(--pink-deep);
  background: var(--bg-soft); padding: 3px 9px; border-radius: 999px;
}
.dot-time { font-size: 11.5px; color: var(--ink-soft); }

/* 카테고리 보기용 세로 리스트 카드 */
.list { padding: 4px 16px 10px; display: flex; flex-direction: column; gap: 12px; }
.lcard {
  display: flex; gap: 13px; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s;
}
.lcard:active { transform: scale(0.98); }
.lcard .thumb {
  flex: 0 0 66px; height: 66px; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.lcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lcard .l-body { flex: 1; min-width: 0; }
.lcard h4 { font-size: 15px; margin: 0 0 6px; }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; font-size: 14px; }

/* ---------- 하단 네비게이션 ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--maxw);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 30;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--ink-soft); font-weight: 600;
}
.tabbar a .ti { font-size: 20px; display: flex; align-items: center; justify-content: center; height: 24px; }
.tabbar a .ti svg { width: 23px; height: 23px; display: block; }
.tabbar a .ti .ti-logo { width: 23px; height: 23px; border-radius: 6px; display: block; }
.tabbar a.active { color: var(--pink-deep); }

/* ---------- 공통 버튼 ---------- */
.btn {
  display: inline-block; background: var(--pink-deep); color: #fff; border: none;
  cursor: pointer; font-weight: 700; font-size: 16px;
  padding: 14px 26px; border-radius: 999px; box-shadow: var(--shadow);
  transition: transform 0.14s, filter 0.14s;
}
.btn:active { transform: scale(0.97); }
.btn.ghost { background: #fff; color: var(--pink-deep); border: 2px solid var(--pink); box-shadow: none; }
.btn.block { display: block; width: 100%; }

/* ---------- 테스트 진행 화면 ---------- */
.quiz {
  padding: 24px 16px 40px; text-align: center;
  /* 테스트 색을 위에서 은은하게 깔고 아래로 fade (가독성 유지) */
  background: linear-gradient(180deg, var(--accent-soft, var(--bg)) 0%, var(--bg) 88%);
  min-height: calc(100vh - 56px - var(--nav-h));
  transition: background 0.3s ease;
}
.progress-track { height: 10px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin: 6px 0 26px; }
.progress-fill { height: 100%; background: var(--accent-grad, linear-gradient(90deg, var(--pink), var(--pink-deep))); width: 0; transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1); border-radius: 999px; }
.q-count { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; font-weight: 700; }
/* 질문 카드 (poomang 느낌: 마스코트 이모지 + 질문을 카드 안에, 테스트 색으로 테마) */
.q-card {
  background: var(--card); border-radius: 22px; padding: 28px 20px 24px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  margin: 34px 0 24px; position: relative;
  animation: qCardIn 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.q-emoji {
  width: 66px; height: 66px; margin: -55px auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 35px;
  background: var(--accent-grad, linear-gradient(135deg, var(--pink), var(--pink-deep)));
  box-shadow: 0 8px 18px rgba(60, 70, 140, 0.2); border: 4px solid var(--card);
}
.q-text { font-size: 20px; font-weight: 700; line-height: 1.42; }
@keyframes qCardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.options { display: flex; flex-direction: column; gap: 11px; }
.options.locked { pointer-events: none; } /* 선택 후 잠금(중복 탭 방지) */
.option {
  position: relative;
  background: #fff; border: 2px solid var(--line); border-radius: 15px;
  padding: 16px 18px; font-size: 15px; font-weight: 600; color: var(--ink);
  cursor: pointer; text-align: center;
  box-shadow: 0 2px 8px rgba(60, 70, 140, 0.05);
  transition: transform 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
  /* 문항 전환 시 보기들이 순서대로 떠오름 */
  animation: optionIn 0.34s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
  animation-delay: calc(var(--i, 0) * 0.05s);
}
/* 호버 가능한 기기(데스크톱)에서만 리프트 — 모바일 고착 호버 방지 */
@media (hover: hover) {
  .option:hover {
    border-color: var(--accent, var(--pink));
    box-shadow: 0 8px 18px rgba(60, 70, 140, 0.14);
    transform: translateY(-2px);
  }
}
.option:active { transform: scale(0.98); border-color: var(--accent, var(--pink)); }
/* 선택된 보기: 테스트 테마색으로 부드럽게 채워짐 (과한 튐 제거) */
.option.selected {
  border-color: var(--accent, var(--pink-deep));
  background: var(--accent-grad, linear-gradient(135deg, var(--pink), var(--pink-deep)));
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(60, 70, 140, 0.14);
}
@keyframes optionIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* 모션 최소화 선호 시 등장 애니메이션 끔 */
@media (prefers-reduced-motion: reduce) {
  .option { animation: none; }
  .option.selected { animation: none; }
}

/* ---------- 인트로 / 결과 카드 ---------- */
.panel { padding: 28px 16px 50px; text-align: center; }
.panel-card {
  background: var(--card); border-radius: 24px; padding: 34px 22px;
  box-shadow: var(--shadow); border: 2px solid var(--line);
}
.big-emoji { font-size: 72px; }
.intro-thumb {
  width: 130px; height: 130px; border-radius: 30px; margin: 2px auto 8px;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.intro-thumb img { width: 100%; height: 100%; object-fit: cover; }
.intro-info { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 8px; }
.result-pop { animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.panel-card h2 { font-size: 23px; margin: 12px 0 10px; color: var(--pink-deep); }
.panel-card .r-desc { font-size: 14.5px; color: var(--ink); margin-bottom: 16px; white-space: pre-line; text-align: left; }

/* 지수 분포 바 */
.meters { margin-top: 22px; text-align: left; }
.meters-head { font-size: 14px; font-weight: 800; margin-bottom: 12px; }
.meter { margin-bottom: 13px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.meter-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.meter-pct { font-size: 13.5px; font-weight: 800; color: var(--ink-soft); }
.meter-track { height: 12px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.meter-fill {
  height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, #9aa0ff, #6b8cff);
  animation: grow 0.8s ease forwards;
}
.meter.top .meter-pct { color: var(--pink-deep); }
.meter.top .meter-fill { background: linear-gradient(90deg, var(--pink), var(--pink-deep)); }
@keyframes grow { from { width: 0; } }

/* 대표 지수 % 크게 (직관적 표시) */
.top-score {
  display: inline-flex; align-items: baseline; gap: 6px;
  margin: 2px 0 12px; padding: 7px 16px;
  background: var(--bg-soft); border-radius: 999px;
}
.top-score .ts-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.top-score .ts-num { font-size: 26px; font-weight: 900; color: var(--pink-deep); line-height: 1; }

/* 궁합: 잘 맞는 / 안 맞는 성향 */
.match-box { display: flex; gap: 10px; margin-top: 22px; text-align: left; }
.match-box .mb { flex: 1; border-radius: 16px; padding: 14px 12px; border: 1.5px solid var(--line); background: var(--card); }
.match-box .mb.good { border-color: #bcd; background: #f1f7ff; }
.match-box .mb.bad { border-color: #f0d4d4; background: #fff4f4; }
.match-box .mb-head { font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.match-box .good .mb-head { color: #3b7bd6; }
.match-box .bad .mb-head { color: #d96b6b; }
.match-box .mb-emoji { font-size: 30px; }
.match-box .mb-title { font-size: 13.5px; font-weight: 700; margin-top: 3px; color: var(--ink); }
.panel-card .meta { font-size: 13px; color: var(--ink-soft); }
.tags { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-bottom: 6px; }
.tag { font-size: 13px; color: var(--pink-deep); background: var(--bg-soft); padding: 6px 12px; border-radius: 999px; font-weight: 600; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.disclaimer-line { text-align: center; font-size: 11.5px; color: var(--ink-soft); padding: 8px 16px 0; }

/* 결과 화면 관련 테스트 추천 */
.reco { margin-top: 28px; text-align: left; }
.reco-head { font-size: 16px; font-weight: 800; margin-bottom: 12px; padding: 0 2px; }
.reco .list { padding: 0; }

/* ---------- 푸터 ---------- */
.app-footer { text-align: center; padding: 26px 16px; font-size: 12px; color: var(--ink-soft); }
.app-footer .social { margin-top: 6px; font-size: 18px; letter-spacing: 6px; }

/* ---------- 데스크탑 대응 (min-width:760px) ---------- */
@media (min-width: 760px) {
  :root { --maxw: 880px; }            /* 앱 컬럼을 넓힘 (탭바·서랍·바디 모두 이 변수 기준) */

  .app-header { height: 60px; }
  .search-bar { top: 60px; }

  .banner { padding: 42px 30px 38px; }
  .banner h2 { font-size: 35px; letter-spacing: -1px; }
  .banner p { font-size: 15px; margin-top: 12px; }

  /* 가로 스크롤 카드 크게 */
  .tcard { flex-basis: 200px; }
  .tcard .thumb { height: 270px; }
  .poster-title { font-size: 15.5px; }

  /* 카테고리/검색 결과 리스트 → 다열 그리드 */
  .list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

  /* 인트로/질문/결과 화면은 과하게 늘어나지 않게 가운데 정렬 */
  .panel, .quiz { max-width: 600px; margin-left: auto; margin-right: auto; }
  /* 결과 화면 추천 리스트는 폭이 좁으니 2열 */
  .reco .list { grid-template-columns: repeat(2, 1fr); }

  /* 섹션 제목·여백 살짝 키움 */
  .section-head h3 { font-size: 18px; }
}

/* 큰 데스크탑: 리스트 4열까지 */
@media (min-width: 1100px) {
  :root { --maxw: 1040px; }
  .list { grid-template-columns: repeat(4, 1fr); }
}
