:root {
  --navy: #1a2b4a;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #d8e1ee;
  --line-strong: #cbd5e1;
  --key-idle: #94a3b8;
  --danger: #b91c1c;
  --success: #047857;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Pretendard는 있으면 쓰고 없으면 내려간다. 실사용 기준선은 맑은 고딕 700 —
     맑은 고딕엔 800/900 굵기가 없어 700 이상은 전부 같게 렌더된다.
     따라서 강조는 weight가 아니라 크기·대비로 만든다. */
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕",
               system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app {
  min-height: 100vh;
  padding: 28px;
}

.screen {
  width: min(1100px, 100%);
  margin: 0 auto;
}

.start-screen {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.hero-card,
.question-card,
.score-card,
.chart-card,
.score-list-card,
.review-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(26, 43, 74, 0.06);
}

.hero-card {
  width: min(760px, 100%);
  padding: 44px;
  box-shadow: 0 18px 42px rgba(26, 43, 74, 0.08);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  color: var(--navy);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.12rem;
}

.lead {
  max-width: 620px;
  margin: 18px 0 0;
  color: #334155;
  font-size: 1.08rem;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0;
}

.facts span {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--navy);
  font-weight: 700;
}

.notice {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--blue);
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 4px;
}

.start-form {
  margin-top: 26px;
}

.start-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.start-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.start-row input {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.start-row button,
.primary-action,
.result-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 15px 26px;
  min-height: 52px;
}

.test-header,
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.test-header h1,
.result-header h1 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

/* 평상시엔 조용히, 3분 남으면 그때만 경고 (문제보다 눈에 띄면 안 된다) */
.timer {
  min-width: 108px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 2px solid var(--line-strong);
  background: #fff;
  color: var(--navy);
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer.urgent {
  border-color: var(--danger);
  background: #fff1f2;
  color: var(--danger);
}

.progress-wrap {
  height: 12px;
  margin-bottom: 18px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
}

.progress-bar {
  height: 100%;
  background: var(--blue);
  transition: width 0.2s ease;
}

.question-card {
  padding: 28px;
}

.question-text {
  margin: 0 0 24px;
  color: var(--navy);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.question-svg {
  width: min(460px, 100%);
  margin: 0 auto 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.question-svg svg,
.choice-svg svg {
  display: block;
  width: 100%;
  height: auto;
  fill: #1a2b4a;
  stroke: #1a2b4a;
}

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

.choice-button {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  /* 테두리 두께를 전 상태 2px로 고정 — 선택 시 레이아웃이 밀리지 않게 */
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

/* 터치 기기에서 hover가 눌린 채 남는 것을 막는다 */
@media (hover: hover) {
  .choice-button:hover {
    border-color: #93c5fd;
    background: #fbfdff;
  }

  .choice-button:hover .choice-key {
    border-color: var(--blue);
    color: var(--navy);
  }
}

.choice-button:focus {
  outline: none;
}

.choice-button:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* 선택 = 블록 채움이 아니라 번호 원형 체크 + 좌측 액센트 바 */
.choice-button.selected {
  border-color: var(--navy);
  background: #fff;
  box-shadow: inset 4px 0 0 0 var(--blue);
}

.choice-key {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--key-idle);
  border-radius: 50%;
  background: #fff;
  color: #475569;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.choice-button.selected .choice-key {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* 체크 배지: 원(::before) + 획(::after). 폰트 글리프에 의존하지 않는다 */
.choice-button.selected .choice-key::before {
  content: "";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px #fff;
}

/* 배지 원(중심 x=36, y=4)에 체크 획을 맞춘다. 회전 도형이라 광학 보정으로 1px 내린다 */
.choice-button.selected .choice-key::after {
  content: "";
  position: absolute;
  top: 0;
  right: 2px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.choice-content {
  display: grid;
  gap: 8px;
  min-width: 0;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.5;
}

.choice-svg {
  max-width: 110px;
}

.test-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.result-header {
  align-items: flex-start;
}

.score-grid,
.charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.charts {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
}

.score-card,
.chart-card,
.score-list-card,
.review-card {
  padding: 22px;
}

.main-score strong {
  display: block;
  margin: 8px 0;
  color: var(--blue);
  font-size: 4rem;
  line-height: 1;
}

.main-score span,
.main-score p,
.score-card p {
  margin: 0;
  color: #334155;
  font-weight: 700;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
}

.card-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.score-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.score-list .count {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: normal;
  font-weight: 400;
}

.score-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.review-card {
  margin-top: 18px;
}

.review-item {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.review-item summary {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
}

.mark-correct,
.mark-wrong {
  display: inline-flex;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.82rem;
}

.mark-correct {
  background: var(--success);
}

.mark-wrong {
  background: var(--danger);
}

.review-body {
  margin: 12px 0 0 68px;
  color: #334155;
}

.review-body p {
  margin: 8px 0;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.result-actions button:last-child {
  background: var(--navy);
}

.rank-line {
  min-height: 1.6em;
}

/* 브랜드 CTA — 결과를 다 본 사람에게만 노출된다 */
.cta-card {
  margin: 28px 0 6px;
  padding: 28px;
  border-radius: 8px;
  background: var(--navy);
  color: #e8eefc;
}

.cta-card .eyebrow {
  color: #93c5fd;
  letter-spacing: 0.08em;
}

.cta-card h2 {
  color: #fff;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  line-height: 1.4;
}

.cta-card p {
  margin: 12px 0 0;
  max-width: 60ch;
}

.cta-button {
  display: inline-block;
  margin-top: 20px;
  padding: 15px 26px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.cta-button:hover {
  background: #1d4ed8;
}

.result-footer {
  margin: 28px 0 6px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .app {
    padding: 16px;
  }

  .hero-card,
  .question-card,
  .score-card,
  .chart-card,
  .score-list-card,
  .review-card {
    padding: 18px;
  }

  .start-row,
  .test-header,
  .result-header,
  .score-grid,
  .charts {
    grid-template-columns: 1fr;
  }

  .test-header,
  .result-header,
  .test-actions {
    display: grid;
  }

  .timer {
    width: 100%;
  }

  .choice-button {
    min-height: 72px;
  }

  .review-item summary {
    grid-template-columns: 1fr;
  }

  .review-body {
    margin-left: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app {
    padding: 0;
  }

  .result-actions,
  .review-card,
  .cta-card {
    display: none;
  }

  .hero-card,
  .question-card,
  .score-card,
  .chart-card,
  .score-list-card,
  .review-card {
    box-shadow: none;
  }
}
