/* =====================
   Reset / Base
===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden; /* ✅ 페이지 전체 가로 스크롤 차단 */
  touch-action: pan-y;
}

body {
  background: #09090d;
  color: #eaeaea;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* =====================
   App Layout
===================== */
.app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding-top: calc(62px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
  overflow-x: hidden; /* ✅ 내부에서 삐져나오는 것 컷 */
}

/* =====================
   Hero Banner (Legacy Text Block - 유지)
===================== */
.hero-banner {
  margin: 0 0 16px;
  padding: 22px 20px 20px;
  background: #1f1d22;
  border-radius: 0;
  position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.hero-content h1 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 800; /* ✅ 원래대로 복구 */
  letter-spacing: -0.2px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; /* 통일 */
}

.hero-content h1 span {
  color: #b68dff;
}

.hero-content p {
  margin-top: 8px;
  font-size: 11px;
  color: #b9bbc2;
  line-height: 1.45;
}

.hero-indicator {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.hero-indicator .dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: #4c4346;
}

.hero-indicator .dot.active {
  background: #e56b6f;
}

/* =====================
   Tabs
===================== */
.tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  min-width: 60px;
  height: 28px;
  padding: 0 14px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #18161a;
  color: #9e97a8;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(229,107,111,0.15);
}

.tabs button.active {
  background: #e56b6f;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(229, 107, 111, 0.24);
}

/* =====================
   Section Title
===================== */
.section-title {
  padding: 6px 16px 8px;
  font-size: 16px;
  font-weight: 800; /* ✅ 원래대로 유지 */
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; /* 통일 */
}

/* =====================
   Banner Rail & Row
===================== */
.banner-rail {
  padding: 0 0 12px 16px;
}

/* 히어로 전용 레일: 좌우 패딩 제거, 풀폭 느낌 */
.banner-rail.hero-rail {
  padding-left: 0;
  padding-right: 0;
  margin-bottom: 8px;
}

.banner-row {
  width: 100%;
  overflow-x: auto;       /* ✅ 가로 스와이프는 여기서만 */
  overflow-y: hidden;
  display: flex;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 12px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

.banner-row::-webkit-scrollbar {
  display: none;
}

.banner-track {
  display: flex;
  width: max-content;
  gap: 16px;
}

/* 히어로 트랙은 카드 간격 제거 */
.hero-rail .banner-track {
  gap: 0;
}

/* =====================
   Banner Card
===================== */
.banner-card {
  position: relative;
  flex: 0 0 160px; /* 폭 유지 */
  border-radius: 20px;
  overflow: hidden;
  background: #18161a;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  scroll-snap-align: start;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; /* 강제 통일 */
}

/* 히어로 배너 카드 */
.banner-card.hero-card {
  flex: 0 0 100%;
  width: 100%;
  border-radius: 0;
  box-shadow: none;
}

/* 썸네일 */
.card-thumb {
  position: relative;
  height: 180px;
  background: #282228;
  overflow: hidden;
}

/* 히어로 썸네일 높이 */
.hero-card .card-thumb {
  height: 170px;
}

/* 이미지 하단 그라데이션 */
.card-thumb::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  background: linear-gradient(
    to bottom,
    rgba(26,29,34,0) 0%,
    rgba(26,29,34,0.15) 55%,
    rgba(26,29,34,0.35) 80%,
    rgba(26,29,34,0.6) 100%
  );
  pointer-events: none;
}

/* 히어로 카드에는 그라데이션 제거 */
.hero-card .card-thumb::after {
  display: none;
}

/* 이름 (이미지 좌하단) */
.thumb-name {
  position: absolute;
  left: 10px;
  bottom: 6px;
  font-size: 18px;
  font-weight: 600; /* 900 -> 600 완화 */
  color: #ffffff;
  z-index: 2;
}

/* 대화수 배지 */
.chat-count {
  position: absolute;
  right: 10px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.6);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #ffffff;
  z-index: 2;
}

.chat-count img {
  width: 12px;
  height: 12px;
}

/* 카드 하단 정보 */
.card-info {
  padding: 12px 12px 14px;
}

/* 히어로 카드는 하단 정보 영역 없음 */
.hero-card .card-info {
  display: none;
}

/* 태그 */
.badge {
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #b68dff;
  margin-bottom: 4px;

  /* 🔥 핵심: 무조건 1줄 + 넘치면 … */
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 한줄소개 */
.desc {
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400; /* 살짝만 더 선명 */
  letter-spacing: -0.01em;
  color: #d4d0d2;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =====================
   Banner Dots
===================== */
.banner-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 10px;
}

.banner-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4c4346;
  transition: transform 0.15s ease, background 0.15s ease;
}

.banner-dots .dot.active {
  background: #e56b6f;
  transform: scale(1.25);
}

/* =====================
   Legacy Grid (유지용)
===================== */
.grid {
  padding: 0 12px 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.card {
  background: #18161a;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.card .card-thumb {
  height: 130px;
  background: #2e2b2d;
}

.card .card-info {
  padding: 10px;
}

.card .name {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 400;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; /* 통일 */
}


/* =====================
   Tab Panel
===================== */
.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.grid-header {
  padding-top: 4px;
}

.grid-caption {
  padding: 0 16px 12px;
  color: #a8acb6;
  font-size: 12px;
  line-height: 1.45;
}

/* =====================
   Search-like Grid
===================== */
.result-grid {
  padding: 0 12px 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-grid .banner-card {
  width: 100%;
  flex: initial;
  min-width: 0;
}

.result-grid .card-thumb {
  height: 194px;
}

.grid-empty {
  grid-column: 1 / -1;
  padding: 28px 16px;
  border-radius: 18px;
  background: #151218;
  color: #b9bbc2;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

@media (min-width: 431px) {
  .tabs,
  .section-title,
  .grid-caption,
  .result-grid {
    padding-left: 18px;
    padding-right: 18px;
  }

  .banner-rail {
    padding-left: 18px;
  }

  .banner-rail.hero-rail {
    padding-left: 0;
    padding-right: 0;
  }
}
