:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --text: #15171c;
  --muted: #6b7280;
  --line: #e4e6ea;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #191c22;
    --text: #e8eaee;
    --muted: #9aa1ac;
    --line: #2b2f37;
    --accent: #7c9cff;
    --accent-text: #0d1020;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

a { color: var(--accent); }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  padding: 14px 28px;
  font-weight: 600;
}

.primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
}

.primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* 언어 전환 링크 */
.top {
  display: flex;
  justify-content: flex-end;
}

.lang-switch {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
}

.lang-switch:hover { text-decoration: underline; }

/* S1 시작 */
.start {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.start h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.3;
}

.start .lead {
  margin: 0 0 20px;
  font-size: 18px;
}

.error {
  margin: 0;
  color: #d33a2c;
  font-size: 14px;
  text-align: center;
}

.pager + .error,
.questions + .error { margin-top: 24px; }

/* 첫 화면 소개 영역(서버 HTML, .planning/landing.md) */
.about {
  margin-bottom: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.about h2 {
  margin: 32px 0 8px;
  font-size: 18px;
}

.about p { margin: 8px 0; }

.about .definition {
  font-size: 17px;
  font-weight: 600;
}

.about dl { margin: 0; }

.about dt {
  margin-top: 14px;
  font-weight: 600;
}

.about dd {
  margin: 2px 0 0;
  color: var(--muted);
}

/* S2 문항 */
.progress {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: var(--bg);
}

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

.progress .bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}

.page-no {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.q {
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.2s;
}

.q.done { opacity: 0.45; }
.q.done:hover,
.q.done:focus-within { opacity: 1; }

.q-text {
  margin: 0 0 20px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
}

.opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.dot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
}

.dot::before {
  content: "";
  border: 2px solid var(--muted);
  border-radius: 50%;
  transition: background 0.15s, border-color 0.15s;
}

.opt-0 .dot::before,
.opt-4 .dot::before { width: 48px; height: 48px; }
.opt-1 .dot::before,
.opt-3 .dot::before { width: 38px; height: 38px; }
.opt-2 .dot::before { width: 30px; height: 30px; }

.opt:hover .dot::before { border-color: var(--accent); }

.opt input:checked + .dot::before {
  background: var(--accent);
  border-color: var(--accent);
}

.opt input:focus-visible + .dot::before {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.lab {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 32px;
}

.pager [hidden] {
  display: block;
  visibility: hidden;
}

.pager .primary { margin-left: auto; }

/* S3 결과 */
.result-label {
  margin: 24px 0 0;
  text-align: center;
  color: var(--muted);
}

.comparison {
  margin: -20px 0 32px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.result-score {
  margin: 4px 0 32px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
}

.result-score strong {
  font-size: 56px;
  line-height: 1.1;
}

.result-score .level {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.result h2 {
  margin: 40px 0 12px;
  font-size: 18px;
}

.domains,
.hidden-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.domain {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.d-head {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.d-val { color: var(--muted); font-weight: 500; }

.track {
  position: relative;
  height: 12px;
  margin: 8px 0;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.track .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 999px;
}

.track b {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: var(--text);
}

.avg-row {
  position: relative;
  height: 18px;
  margin-top: -4px;
}

.avg {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.track i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--bg);
}

details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

details blockquote {
  margin: 12px 0 8px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-size: 14px;
}

details .translation {
  margin: 0 0 8px;
  font-size: 14px;
}

details a { font-size: 13px; }

.hidden-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.h-q {
  margin: 0;
  font-weight: 600;
}

.h-ans {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 14px;
}

.h-exp {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

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

.result footer {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.result footer p { margin: 4px 0; }

.ad { margin: 24px 0; color: var(--muted); font-size: 12px; }
.ad ins { display: block; width: 100%; height: 250px; overflow: hidden; }
