:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2230;
  --muted: #6b7280;
  --border: #e6e8ec;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --track: #eceef1;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --card: #161b25;
    --text: #e8eaf0;
    --muted: #9aa3b2;
    --border: #252c3a;
    --accent: #7c83ff;
    --accent-soft: #1d2030;
    --track: #232a38;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;        /* 한글 단어 단위 줄바꿈 */
  overflow-wrap: anywhere;
}

.app { min-height: 100dvh; display: flex; }

/* ===== 한 화면 = 풀스크린 ===== */
.screen {
  position: relative;
  flex: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.screen-body.center { align-items: center; text-align: center; }

.inner {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  animation: enter 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ===== 상단 진행바 ===== */
.topbar { width: 100%; max-width: 600px; margin: 0 auto; }
.progress { height: 5px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.nav-back {
  font: inherit;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 4px;
  font-size: 0.9rem;
}
.nav-back:disabled { opacity: 0; pointer-events: none; }
.counter { font-size: 0.95rem; font-weight: 700; }
.counter-total { color: var(--muted); font-weight: 600; }

/* ===== 인트로 ===== */
.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
}
.hero-title {
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.hero-sub {
  color: var(--muted);
  font-size: clamp(0.95rem, 3vw, 1.05rem);
  line-height: 1.5;
  margin: 0 0 32px;
}
.hero-meta { color: var(--muted); font-size: 0.85rem; margin: 18px 0 0; }

.btn-cta {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 16px 32px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.btn-cta span { transition: transform 0.2s ease; }
.btn-cta:hover { opacity: 0.94; }
.btn-cta:hover span { transform: translateX(4px); }
.btn-cta:active { transform: scale(0.98); }

/* ===== 질문 ===== */
.axis-chip {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.q-title {
  font-size: clamp(1.4rem, 5.2vw, 2rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}

.options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease,
    box-shadow 0.12s ease;
}
.opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.opt:active { transform: scale(0.99); }
.opt.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.opt-key {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--track);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  transition: background 0.12s ease, color 0.12s ease;
}
.opt:hover .opt-key,
.opt.is-selected .opt-key { background: var(--accent); color: #fff; }
.opt-text { font-size: 1rem; line-height: 1.4; }

.kbd-hint { display: none; color: var(--muted); font-size: 0.8rem; margin: 18px 0 0; text-align: center; }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: block; } }

/* ===== 로딩 ===== */
.loading { text-align: center; color: var(--muted); }
.spinner {
  width: 38px; height: 38px;
  margin: 0 auto 16px;
  border: 3px solid var(--track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 결과 ===== */
.result-inner { width: 100%; }
.result-eyebrow { color: var(--muted); margin: 0 0 14px; font-size: 0.95rem; }
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 16px;
}
.level-emoji { font-size: clamp(1.6rem, 6vw, 2rem); }
.level-name { font-size: clamp(1.6rem, 6vw, 2rem); font-weight: 800; letter-spacing: -0.02em; }
.level-tagline { font-weight: 600; font-size: 1rem; margin: 0 0 10px; }
.level-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 auto 8px;
  max-width: 440px;
}
.result-note {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 16px auto 0;
  max-width: 440px;
  text-align: left;
}

.axes { text-align: left; margin: 28px auto 0; max-width: 440px; }
.section-h { font-size: 0.82rem; color: var(--muted); font-weight: 600; margin: 0 0 12px; }
.axis-row {
  display: grid;
  grid-template-columns: 84px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}
.axis-name { font-size: 0.84rem; color: var(--muted); }
.axis-track { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.axis-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.axis-pct { font-size: 0.8rem; color: var(--muted); text-align: right; }

.result-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 24px auto 0;
  max-width: 440px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.result-actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.link-btn {
  font: inherit;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }

/* ===== 모드 배지 ===== */
.mode-badge {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 0.72rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 2;
}

/* ===== 모바일 ===== */
@media (max-width: 480px) {
  .screen {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
  .opt { padding: 16px; gap: 12px; }
  .opt-text { font-size: 0.95rem; }
  .axis-row { grid-template-columns: 72px 1fr 36px; gap: 8px; }
  .axis-name { font-size: 0.8rem; }
  .level-desc { font-size: 0.88rem; }
  .hero-sub { margin-bottom: 26px; }
}
@media (max-width: 360px) {
  .axis-row { grid-template-columns: 62px 1fr 34px; }
  .axis-name { font-size: 0.76rem; }
}
