@font-face {
  font-family: "GowunDodum";
  src: url("/static/GowunDodum-Regular.ttf") format("truetype");
  font-display: swap;
}

/* ── Design Tokens ── */
:root {
  --bg: #fbf7f2;
  --paper: #fffaf6;
  --surface: #ffffff;
  --ink: #2f2933;
  --muted: #766d77;
  --subtle: #a0969f;
  --line: #e9ded6;
  --rose: #e87580;
  --rose-strong: #d76470;
  --rose-soft: #ffe9ed;
  --mint: #55c5ad;
  --mint-soft: #e8f8f4;
  --yellow-soft: #fff4cc;
  --purple-soft: #f0e6ff;
  --shadow: 0 14px 34px rgba(82, 63, 71, 0.08);
  --shadow-lg: 0 20px 50px rgba(82, 63, 71, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "GowunDodum", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fffdfb 0%, var(--bg) 58%, #fffaf6 100%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ── Layout Shell ── */
.quiz-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 16px;
}

/* ── Screens ── */
.screen {
  display: none;
  width: 100%;
  max-width: 520px;
  animation: fadeSlideUp 0.5s var(--transition) both;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

/* ── Start Screen ── */
.start-screen {
  justify-content: center;
  padding: 60px 0 40px;
  text-align: center;
  gap: 12px;
}

.start-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

.start-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--rose-soft);
  color: var(--rose-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.start-title {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.3;
  color: var(--ink);
  margin-top: 8px;
}

.start-title em {
  font-style: normal;
  color: var(--rose);
}

.start-subtitle {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 4px;
}

.start-illustration {
  width: 220px;
  height: 220px;
  margin: 24px auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-soft), var(--mint-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(232, 117, 128, 0.15);
  overflow: hidden;
  position: relative;
}

.start-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.start-illustration::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.start-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--subtle);
}

.start-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-start {
  width: 100%;
  max-width: 320px;
  padding: 16px 24px;
  margin-top: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-strong) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  box-shadow: 0 8px 24px rgba(232, 117, 128, 0.35);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

@media (hover: hover) {
  .btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(232, 117, 128, 0.45);
  }
}

.btn-start:active {
  transform: translateY(0);
}

/* ── Question Screen ── */
.question-screen {
  padding: 24px 0 40px;
  gap: 20px;
}

/* Progress */
.progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose), var(--mint));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Question Card */
.question-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(233, 222, 214, 0.5);
  animation: fadeSlideUp 0.4s ease both;
}

.question-number {
  display: inline-block;
  padding: 4px 12px;
  background: var(--rose-soft);
  color: var(--rose-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.question-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
  word-break: keep-all;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  transition: all 0.25s ease;
  word-break: keep-all;
}

@media (hover: hover) {
  .option-btn:hover {
    border-color: var(--rose);
    background: var(--rose-soft);
    transform: translateX(4px);
  }
}

.option-btn:active {
  transform: translateX(2px) scale(0.99);
}

.option-btn.selected {
  border-color: var(--rose);
  background: var(--rose-soft);
  color: var(--rose-strong);
  font-weight: 700;
}

/* Navigation */
.question-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.btn-prev {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .btn-prev:hover {
    color: var(--ink);
    background: rgba(0, 0, 0, 0.04);
  }
}

.btn-prev:disabled {
  opacity: 0;
  pointer-events: none;
}

/* ── Loading Screen ── */
.loading-screen {
  justify-content: center;
  align-items: center;
  padding: 80px 0;
  text-align: center;
  gap: 28px;
}

.loading-hamster {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-soft), var(--yellow-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  animation: hamsterBounce 1s ease-in-out infinite;
  box-shadow: 0 12px 40px rgba(232, 117, 128, 0.15);
}

@keyframes hamsterBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.05);
  }
}

.loading-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.6;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 2px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rose);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.loading-sub {
  font-size: 13px;
  color: var(--subtle);
}

/* ── Result Screen ── */
.result-screen {
  padding: 32px 0 60px;
  gap: 20px;
}

.result-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(233, 222, 214, 0.5);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--rose), var(--mint), var(--rose));
  background-size: 200% 100%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

.result-image-wrap {
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-soft), var(--mint-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(232, 117, 128, 0.12);
  overflow: hidden;
  position: relative;
}

.result-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

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

.result-type-name {
  font-size: 26px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 4px;
}

.result-tagline {
  font-size: 15px;
  color: var(--rose);
  font-weight: 700;
  margin-bottom: 16px;
}

.result-description {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.75;
  text-align: left;
  word-break: keep-all;
  padding: 16px;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* Compatibility */
.result-compat {
  width: 100%;
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.compat-card {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
}

.compat-card.good {
  background: var(--mint-soft);
  border: 1px solid rgba(85, 197, 173, 0.2);
}

.compat-card.bad {
  background: var(--rose-soft);
  border: 1px solid rgba(232, 117, 128, 0.2);
}

.compat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--subtle);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compat-card.good .compat-label {
  color: var(--mint);
}

.compat-card.bad .compat-label {
  color: var(--rose);
}

.compat-emoji {
  font-size: 28px;
  margin-bottom: 4px;
}

.compat-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

/* Score breakdown */
.result-scores {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(233, 222, 214, 0.5);
}

.scores-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 14px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.score-row:last-child {
  margin-bottom: 0;
}

.score-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 110px;
  white-space: nowrap;
}

.score-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease;
}

.score-bar-fill.top {
  background: linear-gradient(90deg, var(--rose), var(--rose-strong));
}

.score-bar-fill.normal {
  background: var(--subtle);
  opacity: 0.5;
}

.score-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--subtle);
  min-width: 32px;
  text-align: right;
}

/* Action Buttons */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.btn-share {
  width: 100%;
  padding: 15px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-strong) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(232, 117, 128, 0.3);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

@media (hover: hover) {
  .btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(232, 117, 128, 0.4);
  }
}

.btn-copy-link {
  width: 100%;
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--line);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

@media (hover: hover) {
  .btn-copy-link:hover {
    border-color: var(--rose);
    background: var(--rose-soft);
  }
}

.btn-retry {
  width: 100%;
  padding: 14px 24px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .btn-retry:hover {
    color: var(--ink);
  }
}

/* App CTA */
.app-cta {
  width: 100%;
  background: linear-gradient(135deg, #2f2933, #463a4a);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.app-cta::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(232, 117, 128, 0.15);
  pointer-events: none;
}

.app-cta-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  position: relative;
}

.app-cta-sub {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 16px;
  position: relative;
}

.app-cta-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  position: relative;
}

.btn-appstore,
.btn-playstore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-appstore {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-playstore {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

@media (hover: hover) {
  .btn-appstore:hover,
  .btn-playstore:hover {
    background: rgba(255, 255, 255, 0.25);
  }
}

/* ── Footer ── */
.quiz-footer {
  width: 100%;
  max-width: 520px;
  text-align: center;
  padding: 24px 0 32px;
  font-size: 12px;
  color: var(--subtle);
}

.quiz-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 24px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transition: transform 0.35s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .start-title {
    font-size: 24px;
  }

  .start-illustration {
    width: 180px;
    height: 180px;
  }

  .question-card {
    padding: 22px 18px;
  }

  .question-text {
    font-size: 16px;
  }

  .option-btn {
    padding: 14px 16px;
    font-size: 14px;
  }

  .result-card {
    padding: 24px 18px;
  }

  .result-type-name {
    font-size: 22px;
  }

  .result-image-wrap {
    width: 150px;
    height: 150px;
  }

  .result-compat {
    flex-direction: column;
  }

  .app-cta-buttons {
    flex-direction: column;
    align-items: center;
  }
}

@media (min-width: 640px) {
  .start-screen {
    padding: 80px 0 60px;
  }

  .start-illustration {
    width: 260px;
    height: 260px;
  }

  .start-title {
    font-size: 32px;
  }

  .question-card {
    padding: 36px 32px;
  }

  .result-card {
    padding: 40px 32px;
  }

  .result-image-wrap {
    width: 200px;
    height: 200px;
  }
}
