:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #f43f5e;
  --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.5);
  --text-main: #1f2937;
  --text-light: #6b7280;
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  --border-radius: 24px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: linear-gradient(135deg, #1e1e2f 0%, #2a2a40 100%);
    --card-bg: rgba(30, 30, 46, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f9fafb;
    --text-light: #d1d5db;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1.6;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 481px) {
  .app-container { padding: 20px; }
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.4s ease-out forwards;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 40px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Typography */
.subtitle {
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 24px;
  word-break: keep-all;
}

.description {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 32px;
  word-break: keep-all;
}

/* Images */
.cover-image-container {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  margin: 0 auto 24px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cover-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cover-image-container:hover img {
  transform: scale(1.05);
}

/* Buttons */
.theme-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.theme-btn {
  background: var(--card-bg);
  border: 2px solid var(--primary-color);
  color: var(--text-main);
  padding: 16px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

button {
  border: none;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  border-radius: 16px;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  width: 100%;
  padding: 16px;
}

button:active {
  transform: scale(0.98);
}

.primary-btn {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.primary-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
  transform: translateY(-2px);
}

.secondary-btn {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--primary-color);
  margin-bottom: 12px;
}

.secondary-btn:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* Pulse Animation for Start Button */
.pulse-anim {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 4px;
}



/* BGM Toggle — 언어 스위처(우상단) 아래에 배치, 겹침 방지 */
.bgm-toggle {
  position: fixed;
  top: 60px;          /* 언어 스위처(top:16, height:32) 바로 아래 */
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.95rem;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.bgm-toggle:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.bgm-toggle.muted {
  opacity: 0.6;
  text-decoration: line-through;
}

/* Split Screen Layout (Landscape) */
/* ============================================================
 * MBTI 설문 화면 — 모바일 세로 우선 재디자인
 * 기본: 상하 카드 분할 (모바일 세로)
 * 가로 모드: 좌우 카드 분할 (orientation: landscape)
 * ============================================================ */

/* ⚠️ display는 .screen / .screen.active 규칙에 맡김 — 항상 깔리는 것 방지 */
.split-screen {
  padding: 0 !important;
  max-width: none !important;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* 동적 뷰포트 (iOS 주소창 대응) */
  position: fixed !important;
  top: 0;
  left: 0;
  z-index: 100;
  background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 100%);
  flex-direction: column;
  transition: opacity 0.4s ease;
}

/* 비활성 상태에서는 강제 숨김 (포인터 가로챔 방지) */
.split-screen:not(.active) {
  display: none !important;
}

.split-screen.fade-out { opacity: 0; }

/* ===== 상단 헤더 ===== */
.question-header {
  position: relative;
  width: 100%;
  z-index: 15;
  padding: max(16px, env(safe-area-inset-top, 16px)) 20px 14px;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: auto;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.question-header .question-number {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  display: inline-block;
  width: fit-content;
}

.question-header .question-text {
  font-size: clamp(1rem, 4.2vw, 1.25rem);
  font-weight: 700;
  line-height: 1.45;
  margin: 4px 0 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  word-break: keep-all;
  max-width: 640px;
}

.question-header .progress-container {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin: 6px auto 0;
  overflow: hidden;
}

.question-header .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), #ec4899);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

/* ===== 카드 컨테이너 ===== */
.split-container {
  display: flex;
  flex-direction: column;       /* 모바일 세로: 상하 분할 (기본) */
  width: 100%;
  flex: 1;
  position: relative;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
}

/* ===== A/B 카드 ===== */
.split-btn {
  flex: 1;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.08);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.3);
  transition: flex 0.5s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.3s ease,
              transform 0.2s ease,
              border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  min-height: 0; /* flex 자식이 줄어들 수 있게 */
}

.split-btn:nth-child(1) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(99, 102, 241, 0.3));
}
.split-btn:nth-child(3) {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.4), rgba(244, 63, 94, 0.3));
}

.split-btn:hover,
.split-btn:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.01);
}

.split-btn .bg-img {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.split-btn:hover .bg-img,
.split-btn:focus-visible .bg-img {
  opacity: 0.7;
  transform: scale(1.04);
}

.img-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg,
              rgba(0,0,0,0.1) 0%,
              rgba(0,0,0,0.3) 60%,
              rgba(0,0,0,0.75) 100%);
  pointer-events: none;
  border-radius: 22px;
  transition: opacity 0.3s ease;
}

/* ===== 답변 텍스트 (이제 카드 하단에 명확히 배치) ===== */
.answer-text {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 20px 20px;
  color: white;
  font-size: clamp(0.95rem, 3.6vw, 1.15rem);
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 2px 8px rgba(0,0,0,0.85);
  word-break: keep-all;
  text-align: left;
  z-index: 3;
  pointer-events: none;  /* 클릭이 부모 .split-btn으로 통과하게 */
}

.answer-text::before {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
  margin-bottom: 8px;
  opacity: 0.9;
}

.split-btn:nth-child(3) .answer-text::before {
  background: #ec4899;
}

/* ===== VS 배지 (가운데, 카드 사이) ===== */
.vs-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--primary-color), #ec4899);
  color: white;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5),
              0 0 0 4px rgba(0, 0, 0, 0.4),
              0 0 0 5px rgba(255, 255, 255, 0.15);
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== 애니메이션 상태 ===== */
.split-screen.animating .question-header,
.split-screen.animating .vs-badge,
.split-screen.animating .answer-text,
.split-screen.animating .img-overlay {
  opacity: 0 !important;
}

.split-btn.expanded {
  flex: 1 0 100%;
  z-index: 20;
}

.split-btn.shrunk {
  flex: 0 0 0%;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

/* ===== 가로 모드: 좌우 분할 ===== */
@media (orientation: landscape) and (min-height: 400px) {
  .split-container {
    flex-direction: row;
    padding: 10px;
    gap: 10px;
  }
  .split-btn {
    border-radius: 22px;
  }
  .question-header {
    padding: 14px 24px 12px;
  }
  .question-header .question-text {
    font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  }
  .answer-text {
    font-size: clamp(0.9rem, 1.8vw, 1.05rem);
    padding: 14px 18px 18px;
  }
}

/* ===== 좁은 모바일 추가 조정 ===== */
@media (max-width: 380px) {
  .question-header { padding: 12px 14px 10px; }
  .question-header .question-text { font-size: 1rem; }
  .split-container { padding: 8px; gap: 6px; }
  .answer-text { font-size: 0.95rem; padding: 14px 16px 16px; }
  .vs-badge { width: 44px; height: 44px; font-size: 0.9rem; }
}

/* ===== 광고 배너 (스플릿 하단) ===== */
.split-ad-banner {
  height: 60px;
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.78rem;
  z-index: 10;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  position: relative;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Loading Screen */
.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-card h2 {
  font-size: 1.4rem;
  margin-bottom: 12px;
}

/* Result Screen */
.result-subtitle {
  color: var(--primary-color);
  font-size: 1rem;
  margin-bottom: 8px;
}

.result-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--secondary-color);
}

.result-image-container {
  width: 160px;
  height: 160px;
  background: var(--bg-gradient);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 24px;
  box-shadow: var(--shadow);
}

.result-emoji {
  font-size: 80px;
}

.result-details {
  text-align: left;
  margin-bottom: 40px;
  width: 100%;
}

.result-section {
  background: rgba(0,0,0,0.03);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 16px;
}

.result-section h4 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-section p {
  color: var(--text-main);
  line-height: 1.6;
  font-size: 0.95rem;
  word-break: keep-all;
}

.match-container {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.match-box {
  flex: 1;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(0,0,0,0.05);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.match-box.good h5 { color: #10b981; }
.match-box.bad h5 { color: #ef4444; }

.match-box h5 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.match-box p {
  font-weight: 800;
  font-size: 1.2rem;
  margin: 0;
}

.action-buttons {
  width: 100%;
}

/* ============================================================
 * AdSense 인터리빙 광고 시스템
 * ============================================================ */

/* 공통 광고 슬롯 */
.ad-slot {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  border: 1px dashed rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  margin: 16px 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-light);
  overflow: hidden;
  min-height: 90px;
  padding: 24px 16px;
}

@media (prefers-color-scheme: dark) {
  .ad-slot {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
  }
}

/* "광고" 라벨 — AdSense 정책 필수 */
.ad-label {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 0.68rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-light);
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 2;
}

@media (prefers-color-scheme: dark) {
  .ad-label { background: rgba(0, 0, 0, 0.3); }
}

.ad-label-strong {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.ad-placeholder-text {
  font-size: 0.85rem;
  color: var(--text-light);
  text-align: center;
}

.ad-slot:has(ins.adsbygoogle) .ad-placeholder-text { display: none; }
.ad-slot:has(ins.adsbygoogle) {
  background: transparent;
  border: none;
  padding: 0;
}

/* 디스플레이 배너 광고 */
.ad-slot--display { min-height: 100px; }
.ad-slot--display:first-child { margin-top: 0; }
.ad-slot--display:last-child { margin-bottom: 0; }

/* 인피드 광고 화면 (질문 4번마다) */
.infeed-ad-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.infeed-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 8px 0 6px;
  word-break: keep-all;
}

.infeed-desc {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 20px;
  word-break: keep-all;
}

.ad-slot--infeed {
  min-height: 250px;
  margin: 16px 0 24px;
  flex-direction: column;
}

.infeed-countdown {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-light);
}

.infeed-countdown #infeed-counter {
  font-weight: 800;
  color: var(--primary-color);
}

/* 인아티클 광고 — JS로 결과 단락 사이에 동적 삽입 */
.ad-slot--in-article {
  min-height: 120px;
  margin: 24px 0;
  background: rgba(99, 102, 241, 0.04);
  border-color: rgba(99, 102, 241, 0.2);
}

/* 매치드 콘텐츠 (결과 페이지 하단) */
.matched-content {
  margin: 32px 0 24px;
  text-align: left;
}

.matched-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-main);
}

.matched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.matched-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  min-height: 70px;
}

.matched-card:hover {
  background: rgba(99, 102, 241, 0.12);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}

.matched-card .mc-icon { font-size: 1.8rem; line-height: 1; }

.matched-card .mc-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
}

.matched-card .mc-text strong { font-weight: 800; }
.matched-card .mc-text span { font-size: 0.78rem; color: var(--text-light); }

.matched-card--ad {
  background: rgba(0, 0, 0, 0.03);
  border-style: dashed;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.78rem;
  position: relative;
  padding-top: 24px;
}

@media (prefers-color-scheme: dark) {
  .matched-card { background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.08); }
  .matched-card:hover { background: rgba(99, 102, 241, 0.15); }
  .matched-card--ad { background: rgba(255, 255, 255, 0.02); }
}

/* ============================================================
 * 환경 선택 화면 (3계층 사전 조사)
 * ============================================================ */
.env-card {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.env-title {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 8px;
  word-break: keep-all;
}

.env-subtitle {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 6px;
  word-break: keep-all;
}

.env-desc {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 24px;
  font-style: italic;
  word-break: keep-all;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.env-option {
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(99, 102, 241, 0.15);
  border-radius: 18px;
  padding: 22px 16px;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  width: 100%;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.env-option:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(236,72,153,0.05));
  border-color: var(--primary-color);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(99,102,241,0.18);
}

.env-option .env-icon {
  font-size: 3rem;
  line-height: 1;
}

.env-option-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 4px 0 2px;
  color: var(--text-main);
  word-break: keep-all;
}

.env-option-target {
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 4px;
  word-break: keep-all;
}

.env-option-desc {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.4;
  word-break: keep-all;
}

@media (prefers-color-scheme: dark) {
  .env-option {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .env-option:hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(236,72,153,0.1));
    border-color: var(--primary-color);
  }
}

/* ============================================================
 * 환경 advice 카드 (결과 페이지)
 * ============================================================ */
.env-advice-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(236,72,153,0.05));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 18px;
  padding: 22px 20px;
  margin: 20px 0;
}

.env-advice-card h4 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 800;
}

.env-advice-card .advice-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: keep-all;
}

.env-advice-card .advice-line .ic {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============================================================
 * 다음 추천 서비스 강화 카드 (결과 페이지)
 * ============================================================ */
.next-recommend {
  margin: 28px 0 16px;
}

.next-recommend-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text-main);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.next-recommend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.next-recommend-card {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  border-radius: 18px;
  padding: 22px 18px;
  text-decoration: none;
  text-align: left;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(99,102,241,0.25);
}

.next-recommend-card.love {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  box-shadow: 0 6px 20px rgba(236,72,153,0.25);
}

.next-recommend-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(99,102,241,0.4);
}

.next-recommend-card.love:hover {
  box-shadow: 0 14px 36px rgba(236,72,153,0.4);
}

.next-recommend-card .nrc-icon { font-size: 2rem; line-height: 1; }
.next-recommend-card .nrc-title { font-size: 0.95rem; font-weight: 800; }
.next-recommend-card .nrc-desc { font-size: 0.85rem; opacity: 0.92; line-height: 1.4; }
.next-recommend-card .nrc-cta { font-size: 0.85rem; font-weight: 700; margin-top: 4px; opacity: 0.95; }

/* ============================================================
 * 컨텍스트 배지 (상단 고정)
 * ============================================================ */
.ctx-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  max-width: calc(100vw - 200px);
  flex-wrap: wrap;
}

.ctx-bar.active { display: inline-flex; }

.ctx-bar .ctx-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
}

.ctx-bar .ctx-clear {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-family: inherit;
}
.ctx-bar .ctx-clear:hover { background: rgba(255,255,255,0.15); }

body:has(.split-screen.active) .ctx-bar { display: none !important; }

/* 포털 홈 링크 (좌상단) */
.portal-home-link {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.portal-home-link:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateX(-2px);
}

/* 가로 스플릿 화면에서는 홈 링크 숨김 (몰입감 우선) */
body:has(.split-screen.active) .portal-home-link { display: none; }

/* 레거시 .ad-banner 호환 */
.ad-banner {
  width: 100%;
  background: rgba(0,0,0,0.05);
  border: 1px dashed rgba(0,0,0,0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 20px;
  margin: 20px 0;
  border-radius: 12px;
  min-height: 100px;
}

.top-ad { margin-top: 0; }
.bottom-ad { margin-bottom: 0; }

/* 다음 추천 카드 가독성 강화 (대장님 갭 분석 v5) */
.next-recommend-card .nrc-desc {
  opacity: 1 !important;
  color: rgba(255, 255, 255, 0.96) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.next-recommend-card .nrc-cta {
  opacity: 1 !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.20);
  font-weight: 800 !important;
}
.next-recommend-card .nrc-title {
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}
