:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #111827;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent: #00c471;
  --accent-warm: #ff6b57;
  --yellow: #ffe066;
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(215deg, rgba(0, 196, 113, 0.12), transparent 38%),
    var(--bg);
  color: var(--text);
  word-break: keep-all;
}

button {
  font: inherit;
}

body.menu-open {
  overflow: hidden;
}

.app {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.mobile-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  background: rgba(248, 250, 252, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.menu-btn {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-content: center;
  gap: 5px;
  background: transparent;
  cursor: pointer;
}

.share-btn {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-left: auto;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.share-btn svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.menu-btn span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.header-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 900;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15, 23, 42, 0.36);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.menu-overlay.open {
  opacity: 1;
}

.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: min(72vw, 320px);
  max-width: 320px;
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid var(--border);
  box-shadow: 18px 0 40px rgba(15, 23, 42, 0.18);
  transform: translateX(-104%);
  transition: transform 0.24s ease;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 18px;
}

.side-menu-head p {
  margin: 0;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 900;
}

.menu-close-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.menu-list {
  display: grid;
  gap: 8px;
}

.menu-item {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.menu-item.active {
  border-color: rgba(37, 99, 235, 0.18);
  background: #eff6ff;
  color: var(--primary);
}

.menu-item:disabled {
  color: var(--muted);
  cursor: default;
}

.intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 92px 20px 32px;
}

.brand-mark {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.22);
  transform: rotate(-4deg);
}

.brand-mark span {
  font-size: 1.05rem;
  font-weight: 900;
  transform: rotate(4deg);
}

.eyebrow,
.result-kicker {
  margin: 22px 0 10px;
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 800;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  line-height: 1.16;
  letter-spacing: 0;
}

.intro-copy {
  width: min(520px, 100%);
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.75;
}

.primary-btn {
  margin-top: 42px;
  border: 0;
  border-radius: 14px;
  padding: 16px 44px;
  color: white;
  background: var(--primary);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.24);
}

.primary-btn:hover {
  background: var(--primary-strong);
}

.primary-btn:active,
.link-btn:active,
.choice:active {
  transform: translateY(1px);
}

.test {
  min-height: 100vh;
  padding: 88px 16px 44px;
}

.progress {
  position: fixed;
  inset: 60px 0 auto 0;
  height: 5px;
  background: rgba(37, 99, 235, 0.13);
  z-index: 5;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.25s ease;
}

.question-pages {
  width: min(760px, 100%);
  margin: 0 auto;
}

.page {
  display: grid;
  gap: 16px;
}

.question-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.q-number {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.question-card h2 {
  margin: 0 0 22px;
  font-size: 1.16rem;
  line-height: 1.62;
  letter-spacing: 0;
}

.choices {
  display: grid;
  gap: 12px;
}

.choice {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  line-height: 1.55;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.choice:hover,
.choice.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.choice.selected {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.result {
  min-height: 100vh;
  padding: 60px 16px 36px;
}

.result-header {
  position: sticky;
  top: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  margin: 0 -16px 28px;
  padding: 16px 20px;
  background: rgba(248, 250, 252, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.result-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.result-card {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 28px 20px;
  text-align: center;
}

.result-kicker {
  margin-top: 0;
}

.nickname {
  margin: 0 0 22px;
  font-size: clamp(1.8rem, 7vw, 3rem);
  color: var(--text);
  font-weight: 900;
  line-height: 1.25;
}

.mbti-seal {
  width: 122px;
  height: 122px;
  border-radius: 34px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 2.05rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 18px 38px rgba(37, 99, 235, 0.2);
}

.axis-bars {
  display: grid;
  gap: 22px;
  text-align: left;
}

.analysis-card {
  margin: 0 0 34px;
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.analysis-card h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 1.02rem;
  line-height: 1.35;
}

.analysis-card p {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.86;
}

.axis-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.axis-track {
  height: 18px;
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.axis-a {
  background: var(--primary);
}

.axis-b {
  background: var(--accent-warm);
}

.axis-intensity {
  margin-top: 6px;
  color: var(--faint);
  font-size: 0.78rem;
}

.saved-at {
  margin: 34px 0 0;
  color: var(--faint);
  font-size: 0.8rem;
}

.fortune {
  min-height: 100vh;
  padding: 92px 16px 36px;
}

.fortune-shell {
  width: min(560px, 100%);
  margin: 0 auto;
  text-align: center;
}

.fortune-shell h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 7vw, 3.2rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.fortune-copy {
  margin: 16px auto 28px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.fortune-deck {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 auto 28px;
}

.fortune-card {
  width: 100%;
  min-height: 148px;
  border: 0;
  border-radius: 20px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 34%),
    linear-gradient(150deg, var(--primary), #14b8a6 56%, var(--accent));
  box-shadow: 0 24px 56px rgba(37, 99, 235, 0.24);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.fortune-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 64px rgba(37, 99, 235, 0.28);
}

.fortune-card.drawn {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 36%),
    linear-gradient(150deg, #0f172a, var(--primary) 52%, var(--accent-warm));
  transform: translateY(-3px);
}

.fortune-card.dimmed {
  opacity: 0.42;
  box-shadow: none;
  cursor: default;
}

.fortune-card-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  opacity: 0.78;
}

.fortune-card strong {
  font-size: 1.32rem;
  line-height: 1.2;
}

.fortune-card span:last-child {
  font-size: 0.92rem;
  font-weight: 800;
  opacity: 0.86;
}

.fortune-result {
  display: grid;
  gap: 14px;
  text-align: left;
}

.fortune-message,
.fortune-detail,
.lucky-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.fortune-message {
  padding: 22px 20px;
}

.fortune-message p,
.lucky-item span {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.fortune-message strong {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.55;
}

.fortune-detail-grid {
  display: grid;
  gap: 14px;
}

.fortune-detail {
  padding: 20px;
}

.fortune-detail h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.02rem;
}

.fortune-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.lucky-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.lucky-item {
  padding: 18px;
}

.lucky-item strong {
  display: block;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1.35;
}

.psychology {
  min-height: 100vh;
  padding: 92px 16px 36px;
}

.psychology-shell {
  width: min(560px, 100%);
  margin: 0 auto;
  text-align: center;
}

.psychology-shell h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.95rem, 7vw, 3.1rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.psychology-copy {
  margin: 16px auto 26px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.psychology-test-list {
  display: grid;
  gap: 14px;
}

.psychology-test-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  text-align: left;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.psychology-test-card span,
.back-btn {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.psychology-test-card strong {
  display: block;
  margin: 8px 0 8px;
  font-size: 1.18rem;
  line-height: 1.42;
}

.psychology-test-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  margin: 0 0 14px;
  padding: 0 12px;
  background: #eff6ff;
  cursor: pointer;
}

.psychology-options {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.psychology-choice {
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-weight: 900;
  text-align: left;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.psychology-choice:hover,
.psychology-choice.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.psychology-choice.selected {
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.psychology-result {
  padding: 24px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.psychology-result p:first-child {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.psychology-result h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1.28;
}

.psychology-result strong {
  display: block;
  margin-bottom: 14px;
  color: var(--accent-warm);
  font-size: 0.92rem;
  line-height: 1.5;
}

.psychology-result p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.76;
}

.psychology-extra {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.psychology-extra h3 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 1.02rem;
}

.psychology-extra h3:first-child {
  margin-top: 0;
}

.psychology-extra p {
  margin: 0;
  color: var(--muted);
  line-height: 1.76;
}

.island-order {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: island;
}

.island-order li {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 800;
  text-align: left;
}

.island-order li::before {
  counter-increment: island;
  content: counter(island) "순위";
  min-width: 46px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.island-order li.filled {
  color: var(--text);
  background: #eff6ff;
}

.island-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.island-item {
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.island-item:disabled {
  color: var(--faint);
  background: var(--surface-soft);
  box-shadow: none;
  cursor: default;
}

.secondary-btn {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  margin: 0 0 18px;
  background: var(--text);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.rank-meaning,
.flow-meaning,
.last-meaning,
.summary-meaning {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.rank-meaning h3,
.flow-meaning h3,
.last-meaning h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.08rem;
}

.rank-meaning,
.flow-meaning {
  display: grid;
  gap: 10px;
}

.rank-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(248, 250, 252, 0.8);
}

.rank-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 900;
}

.rank-card strong {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.02rem;
}

.rank-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.62;
}

.last-meaning p {
  margin: 0;
  color: var(--muted);
  line-height: 1.76;
}

.summary-meaning h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.08rem;
}

.summary-meaning p {
  margin: 0;
  color: var(--muted);
  line-height: 1.76;
}

.advice-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
}

.advice-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.advice-card strong {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.55;
}

@media (max-width: 520px) {
  .intro {
    align-items: flex-start;
    text-align: left;
  }

  .brand-mark {
    width: 78px;
    height: 78px;
    border-radius: 24px;
  }

  .primary-btn {
    width: 100%;
  }

  .question-card {
    padding: 20px;
  }

  .choice {
    padding: 15px;
  }
}
