/* 🐻 홀랜드 진로 탐색 밸런스 게임 - 공통 스타일 */

:root {
  --bg1: #fef6ff;
  --bg2: #eef4ff;
  --primary: #7c5cff;
  --primary-dark: #6647e0;
  --accent: #ff8fb1;
  --ink: #3a3550;
  --muted: #8a86a0;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(124, 92, 255, 0.18);
  --radius: 24px;
}

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

html, body { height: 100%; }

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  display: flex;
  /* align-items: center 대신 margin:auto 사용 — 내용이 길어도 위쪽이 잘리지 않고 스크롤됨 */
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* 떠다니는 배경 이모지 */
.bg-floaties {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-floaties span {
  position: absolute; font-size: 2.4rem; opacity: 0.18;
  animation: float 9s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-26px) rotate(6deg); }
}

.app {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px;
  margin: auto; /* 공간이 있으면 중앙 정렬, 길어지면 스크롤 가능 */
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  text-align: center;
  animation: pop 0.5s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes pop {
  from { transform: scale(.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== 타이틀 / 텍스트 ===== */
.hero-emoji { font-size: 4.5rem; display: block; margin-bottom: 8px; animation: bounce 2s ease-in-out infinite; }
@keyframes bounce { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-12px);} }

h1 { font-size: 1.9rem; line-height: 1.3; margin-bottom: 10px; }
.subtitle { color: var(--muted); font-size: 1rem; line-height: 1.6; margin-bottom: 24px; }
.gradient-text {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ===== 폼 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.field { text-align: left; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 14px 16px; font-size: 1rem;
  border: 2px solid #ece8ff; border-radius: 14px; background: #faf9ff;
  font-family: inherit; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124,92,255,.15);
}

/* ===== 버튼 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px 24px; font-size: 1.15rem; font-weight: 800;
  color: #fff; background: linear-gradient(90deg, var(--primary), var(--accent));
  border: none; border-radius: 16px; cursor: pointer; font-family: inherit;
  box-shadow: 0 8px 20px rgba(124,92,255,.35);
  transition: transform .12s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(124,92,255,.45); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.ghost {
  background: #fff; color: var(--primary); border: 2px solid #e7e1ff;
  box-shadow: none; font-size: 1rem;
}
.btn-row { display: flex; gap: 12px; margin-top: 16px; }

/* ===== 진행 바 ===== */
.quiz-header { margin-bottom: 22px; }
.progress-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }
.progress-info .count { color: var(--primary); }
.progress-info .student { color: var(--muted); font-size: .85rem; font-weight: 600; }
.progress-bar { height: 14px; background: #ece8ff; border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px; transition: width .45s cubic-bezier(.22,.9,.34,1);
}

/* ===== 밸런스 게임 카드 ===== */
.question-title { font-size: 1.25rem; font-weight: 800; margin: 6px 0 20px; }
.balance { display: grid; gap: 16px; }
@media (min-width: 480px) { .balance { grid-template-columns: 1fr 1fr; align-items: stretch; } }

.choice {
  position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 28px 18px; min-height: 200px;
  background: #faf9ff; border: 3px solid #ece8ff; border-radius: 20px;
  cursor: pointer; text-align: center;
  transition: transform .15s, border-color .2s, box-shadow .2s, background .2s;
}
.choice:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.choice:active { transform: scale(.97); }
.choice.picked { animation: picked .4s ease; border-color: var(--primary); background: #f1ecff; }
@keyframes picked { 0%{ transform: scale(1);} 40%{ transform: scale(1.06);} 100%{ transform: scale(1);} }
.choice .emoji { font-size: 3.4rem; }
.choice .text { font-size: 1rem; line-height: 1.5; font-weight: 600; color: var(--ink); }
.vs {
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: var(--accent); font-size: 1.1rem;
}
@media (min-width: 480px) {
  .vs { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    background: #fff; width: 46px; height: 46px; border-radius: 50%;
    box-shadow: var(--shadow); z-index: 2; }
  .balance { position: relative; }
}

/* ===== 결과 화면 ===== */
.result-card {
  border-radius: 24px; padding: 30px 22px; color: #fff; margin-bottom: 18px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.result-card .soul-emoji { font-size: 5.5rem; display: block; animation: bounce 2s infinite; }
.result-card .soul-name { font-size: 2rem; font-weight: 900; margin-top: 4px; }
.result-card .soul-code { font-size: 1rem; opacity: .9; font-weight: 700; letter-spacing: 1px; }
.result-card .soul-desc { margin-top: 14px; font-size: 1rem; line-height: 1.65; opacity: .97; }

.combo-badge {
  display: inline-block; background: rgba(255,255,255,.25);
  padding: 6px 14px; border-radius: 99px; font-weight: 800; font-size: .9rem; margin-top: 12px;
}

.section { background: #faf9ff; border-radius: 18px; padding: 20px; margin-bottom: 16px; text-align: left; }
.section h3 { font-size: 1.05rem; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.job-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.job-tag {
  background: #fff; border: 2px solid #ece8ff; color: var(--primary);
  padding: 8px 14px; border-radius: 99px; font-weight: 700; font-size: .9rem;
}
.role-text { line-height: 1.6; font-weight: 600; color: var(--ink); }

/* 방사형 그래프 */
.chart-wrap { display: flex; justify-content: center; }
canvas { max-width: 100%; }

.student-name-tag { color: var(--muted); font-size: .9rem; margin-bottom: 6px; font-weight: 700; }

#captureArea { background: #fff; border-radius: 18px; }
.capture-watermark { color: var(--muted); font-size: .8rem; font-weight: 700; margin-top: 4px; }
.btn:disabled { opacity: .65; cursor: default; transform: none; box-shadow: none; }

.footer-note { color: var(--muted); font-size: .8rem; margin-top: 18px; line-height: 1.5; }

/* 페이지 전환 페이드 */
.fade-enter { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none;} }

/* ===== 검사 중 응원 토스트 ===== */
.cheer-toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%) translateY(-20px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 99px;
  font-weight: 800; font-size: 1rem; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; z-index: 50; transition: opacity .3s, transform .3s;
}
.cheer-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 결과 카드 등장 연출 ===== */
.result-card.reveal { animation: cardReveal .7s cubic-bezier(.18,.89,.32,1.28) both; }
@keyframes cardReveal {
  0% { opacity: 0; transform: perspective(800px) rotateY(85deg) scale(.9); }
  100% { opacity: 1; transform: perspective(800px) rotateY(0) scale(1); }
}

/* ===== 유형별 백분율 막대 ===== */
.type-bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 42px; align-items: center; gap: 10px; }
.bar-label { font-size: .9rem; font-weight: 700; white-space: nowrap; }
.bar-track { height: 14px; background: #ece8ff; border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0%; border-radius: 99px; transition: width .8s cubic-bezier(.22,.9,.34,1); }
.bar-pct { font-size: .85rem; font-weight: 800; color: var(--muted); text-align: right; }

/* ===== 색종이(confetti) ===== */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti {
  position: absolute; top: -14px; width: 10px; height: 14px; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}
