:root {
  --bg: #f7f6f2;
  --card: #ffffff;
  --ink: #1c1c1a;
  --muted: #5e5e58;
  --line: #e2e0d8;
  --accent: #2b5fd9;
  --accent-ink: #ffffff;
  --o: #7a4fd6; /* 개방성 */
  --c: #2a8f6c; /* 성실성 */
  --e: #e07a1f; /* 외향성 */
  --a: #d6436e; /* 우호성 */
  --n: #3b7fd1; /* 신경성 */
  --radius: 14px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --card: #1f2127; --ink: #ecebe6; --muted: #a7a69f; --line: #30323a;
    --accent: #7ea2ff; --accent-ink: #0f1320;
  }
}
:root[data-theme="dark"] {
  --bg: #15161a; --card: #1f2127; --ink: #ecebe6; --muted: #a7a69f; --line: #30323a;
  --accent: #7ea2ff; --accent-ink: #0f1320;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px; line-height: 1.65; word-break: keep-all;
}
a { color: var(--accent); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 var(--gutter) 64px; }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
header.top .brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 17px; }
header.top nav { display: flex; gap: 6px; }
header.top nav a {
  text-decoration: none; color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 999px;
}
header.top nav a.on { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.25; margin: 10px 0 10px; letter-spacing: -0.01em; }
h2 { font-size: 21px; margin: 36px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 6px; }
p.lead { font-size: 18px; color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.letter { font-size: 17px; line-height: 1.8; padding: 22px 20px; border-left: 5px solid var(--accent); }
.letter p { margin: 0 0 14px; } .letter p:last-child { margin-bottom: 0; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none;
  padding: 12px 20px; border-radius: 999px; font-weight: 700; border: 0; font-size: 16px; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
small, .small { font-size: 13.5px; }
ul, ol { padding-left: 20px; }
li { margin: 4px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.tag { display: inline-block; font-size: 12.5px; padding: 2px 8px; border-radius: 999px; color: #fff; }
.tag.o { background: var(--o); } .tag.c { background: var(--c); } .tag.e { background: var(--e); }
.tag.a { background: var(--a); } .tag.n { background: var(--n); }

/* 5요인 카드 */
.factors { display: grid; grid-template-columns: 1fr; gap: 12px; }
.factor { border-left: 5px solid var(--line); }
.factor.o { border-left-color: var(--o); } .factor.c { border-left-color: var(--c); }
.factor.e { border-left-color: var(--e); } .factor.a { border-left-color: var(--a); } .factor.n { border-left-color: var(--n); }
.factor h3 { margin-top: 0; }
.factor .ends { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--muted); margin-top: 8px; }

/* 테스트 */
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 18px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.q { margin: 0 0 14px; }
.q .stem { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.q .num { color: var(--muted); font-weight: 500; font-size: 14px; display: block; margin-bottom: 4px; }
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.likert label {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; font-size: 12px; color: var(--muted); text-align: center; background: var(--bg);
}
.likert input { margin: 0; width: 20px; height: 20px; accent-color: var(--accent); }
.likert label.sel { border-color: var(--accent); color: var(--ink); background: var(--card); box-shadow: 0 0 0 2px var(--accent) inset; }
.likert .lab { line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* 결과 */
.bar { display: grid; grid-template-columns: 72px 1fr 44px; gap: 10px; align-items: center; margin: 12px 0; }
.bar .name { font-weight: 700; font-size: 15px; }
.bar .track { height: 14px; background: var(--line); border-radius: 999px; position: relative; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }
.bar.o .fill { background: var(--o); } .bar.c .fill { background: var(--c); } .bar.e .fill { background: var(--e); }
.bar.a .fill { background: var(--a); } .bar.n .fill { background: var(--n); }
.bar .val { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.band { font-size: 13px; color: var(--muted); margin: -8px 0 0 82px; }
.hidden { display: none !important; }
footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
@media (min-width: 560px) {
  .factors { grid-template-columns: 1fr 1fr; }
  .likert label { font-size: 13px; }
}
