/* 밈 퀴즈 웹 — landing/styles.css 와 동일한 디자인 토큰(app/theme/tokens.ts 이식)을 공유.
   앱과 별도 산출물이라 파일은 복제하되 값은 항상 같이 맞춘다.

   디자인 방향(2026-08-03 리디자인): "발랄하되 고급스럽게".
   - 발랄함은 색을 많이 쓰는 게 아니라 **움직임과 리듬**에서 낸다 — 화면 전환 시 살짝
     떠오르는 등장, 보기 버튼의 눌림 반응, 점수 카운트업.
   - 고급스러움은 장식이 아니라 **여백·타이포 위계·부드러운 그림자**에서 낸다. 테두리
     한 줄로 눌러 담던 카드를 층이 있는 그림자로 띄우고, 숫자·제목의 자간을 좁힌다.
   - 배경에 아주 옅은 브랜드 그라데이션을 깔아 흰 화면의 밋밋함을 없앤다(색은 거의
     안 보일 정도로만 — 진해지면 촌스러워진다). */

:root {
  --brand-primary: #6D5EF5;
  --brand-primary-pressed: #5847E0;
  --brand-on-primary: #FFFFFF;

  --neutral-bg: #FAFAFC;
  --neutral-surface: #FFFFFF;
  --neutral-border: #E7E5F0;
  --neutral-text-primary: #1C1B29;
  --neutral-text-secondary: #6B6980;
  --neutral-text-muted: #9C9AB0;

  --signal-green: #22C55E;
  --signal-green-bg: #EAFBF0;
  --signal-yellow: #EAB308;
  --signal-yellow-bg: #FEF9E7;
  --signal-red: #EF4444;
  --signal-red-bg: #FDECEC;

  --ai-draft-text: #8A6D00;
  --ai-draft-bg: #FFF6DD;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 64px;

  /* 층이 있는 그림자 — 한 겹짜리 큰 그림자보다 훨씬 자연스럽고 비싸 보인다. */
  --shadow-card: 0 1px 2px rgba(28, 27, 41, 0.04), 0 8px 24px -8px rgba(28, 27, 41, 0.10);
  --shadow-lift: 0 2px 4px rgba(28, 27, 41, 0.05), 0 12px 28px -10px rgba(109, 94, 245, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--neutral-bg);
  color: var(--neutral-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 배경 광원 — 화면 위쪽에 브랜드 컬러를 아주 옅게 번지게 해서 흰 배경의 밋밋함만 없앤다.
   fixed라 스크롤해도 따라오지 않고, 뒤에 깔려 클릭을 막지 않는다. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background:
    radial-gradient(60% 100% at 20% 0%, rgba(109, 94, 245, 0.10), transparent 70%),
    radial-gradient(50% 100% at 85% 5%, rgba(34, 197, 94, 0.07), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl);
}

#app.card,
.container:has(#app) {
  display: flex;
  flex-direction: column;
}
.container:has(#app) {
  min-height: calc(100vh - 64px);
}

/* ---------- 상단 sticky 네비 — 앱 다운로드 버튼 상시 노출 ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 250, 252, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(231, 229, 240, 0.8);
}

.site-nav .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding-top: 0;
  padding-bottom: 0;
}

.site-nav .wordmark {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--neutral-text-primary);
  text-decoration: none;
}

.site-nav .wordmark span { color: var(--brand-primary); }

.site-nav .btn-sm {
  width: auto;
  padding: 9px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lift);
}

.page-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--neutral-text-muted);
  margin-bottom: var(--space-lg);
}

.page-title span { color: var(--brand-primary); }

/* ---------- Card shell ---------- */

.card {
  background: var(--neutral-surface);
  border: 1px solid rgba(231, 229, 240, 0.7);
  border-radius: var(--radius-xl);
  padding: var(--space-xxl);
  box-shadow: var(--shadow-card);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 화면이 바뀔 때마다 살짝 떠오르며 나타난다 — 발랄함의 대부분이 여기서 나온다.
   app.js가 렌더할 때마다 #app의 자식이 통째로 교체되므로 별도 트리거 없이 매번 실행된다. */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.intro, .result, .progress-bar, .question-index, .question-text, .choice-list, .empty-state {
  animation: rise-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* 보기 목록은 살짝 늦게 들어와 질문 → 보기 순서로 읽히게 한다. */
.choice-list { animation-delay: 0.06s; }

/* ---------- Intro screen ---------- */

.intro h1 {
  font-size: 32px;
  line-height: 1.28;
  margin: 0 0 var(--space-md);
  letter-spacing: -0.025em;
}

.intro p {
  color: var(--neutral-text-secondary);
  font-size: 16px;
  margin: 0 0 var(--space-xl);
}

.referral-banner {
  display: inline-block;
  background: var(--signal-yellow-bg);
  color: var(--ai-draft-text);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.intro .meta {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  font-size: 13px;
  color: var(--neutral-text-secondary);
}

/* 메타 정보를 알약으로 감싸면 그냥 회색 텍스트일 때보다 훨씬 정돈돼 보인다. */
.intro .meta span {
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 15px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn:active { transform: translateY(1px) scale(0.995); }

.btn-primary {
  background: linear-gradient(135deg, #7A6BF7, var(--brand-primary));
  color: var(--brand-on-primary);
  box-shadow: var(--shadow-lift);
}

.btn-primary:hover { background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-pressed)); }

.btn-ghost {
  background: var(--neutral-surface);
  color: var(--neutral-text-primary);
  border: 1px solid var(--neutral-border);
}

.btn-ghost:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

/* ---------- Question screen ---------- */

.progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--neutral-border);
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #8B7CF8, var(--brand-primary));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.question-index {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--brand-primary);
  margin-bottom: var(--space-sm);
  font-weight: 800;
}

.question-text {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xl);
  line-height: 1.38;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* 보기에 A/B/C/D 뱃지를 달면 "고르는 행위"가 명확해지고 시선이 왼쪽 기준선에 정렬돼
   목록 전체가 훨씬 단정해 보인다. */
.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  text-align: left;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-border);
  background: var(--neutral-surface);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  cursor: pointer;
  color: var(--neutral-text-primary);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.choice-badge {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-border);
  color: var(--neutral-text-secondary);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.choice-text { flex: 1; }

.choice-btn:not(:disabled):hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.choice-btn:not(:disabled):hover .choice-badge {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--brand-on-primary);
}

.choice-btn:not(:disabled):active { transform: translateY(0) scale(0.995); }

.choice-btn.correct {
  background: var(--signal-green-bg);
  border-color: var(--signal-green);
  color: #157F3B;
}

.choice-btn.correct .choice-badge {
  background: var(--signal-green);
  border-color: var(--signal-green);
  color: #fff;
}

.choice-btn.wrong {
  background: var(--signal-red-bg);
  border-color: var(--signal-red);
  color: #B42318;
}

.choice-btn.wrong .choice-badge {
  background: var(--signal-red);
  border-color: var(--signal-red);
  color: #fff;
}

/* 틀렸을 때 짧게 흔들어 즉각적인 피드백을 준다(감정 없이 정보만 주면 밋밋하다). */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.choice-btn.wrong { animation: shake 0.26s ease; }

.choice-btn:disabled { cursor: default; }
/* 고르지 않은 보기는 뒤로 물러나게 해서 정답/오답에 시선이 모이게 한다. */
.choice-btn:disabled:not(.correct):not(.wrong) { opacity: 0.45; }

/* ---------- Result screen ---------- */

.result .score-big {
  font-size: 68px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
  margin: 0;
  line-height: 1.1;
  background: linear-gradient(135deg, #8B7CF8, var(--brand-primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result .score-sub {
  text-align: center;
  color: var(--neutral-text-secondary);
  font-weight: 600;
  margin: var(--space-xs) 0 var(--space-xl);
}

.result .message-box {
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

.result .cta-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* 데스크톱 설치 안내 — PC에는 앱을 못 깔아서 스토어 버튼이 막다른 길이라, QR로 폰에
   넘겨준다. 모바일에서는 이 블록 자체가 렌더되지 않는다(app.js의 IS_MOBILE 분기). */
.result .desktop-install {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-lg);
  background: var(--neutral-surface);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.result .desktop-install-title {
  font-weight: 700;
  line-height: 1.5;
  margin: 0;
}

.result .desktop-install-qr {
  width: 150px;
  height: 150px;
  border-radius: var(--radius-md);
}

.result .desktop-install-hint {
  font-size: 13px;
  color: var(--neutral-text-secondary);
  margin: 0;
}

.empty-state {
  text-align: center;
  color: var(--neutral-text-secondary);
}

/* 움직임에 민감한 사용자에게는 애니메이션을 끈다(접근성 기본). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
