/* 매스위즈 사용자 화면 스타일 — 모바일 우선, PC에서는 가운데 앱 폭(480px)으로 표시 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1fe;
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #8a94a6;
  --line: #e3e8ef;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --good: #15803d;
  --good-soft: #e9f7ee;
  --bad: #c43333;
  --bad-soft: #fdeeee;
  --warn-soft: #fff6e0;
  --bar: #2a78d6;
  --bar-track: #e7eef8;
  --bar-weak: #d03b3b;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 8px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.sub { color: var(--ink-2); font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* 레이아웃 */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 16px 104px; }
.topbar { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.logo { font-weight: 800; font-size: 20px; color: var(--primary); text-decoration: none; letter-spacing: -0.3px; }
.topbar .right { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.topbar .right a { color: var(--ink-2); text-decoration: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; }
.page-title { margin: 8px 0 16px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 8px; }
.section-title h2 { margin: 0; }
.section-title a { font-size: 14px; text-decoration: none; }

/* 카드 */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.card.hero { background: linear-gradient(135deg, #2f6df0, #1d4ed8); color: #fff; }
.card.hero .sub, .card.hero .muted { color: rgba(255, 255, 255, .85); }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-title { font-weight: 700; margin-bottom: 4px; }

/* 버튼 */
.btn { display: block; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-size: 16px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-white { background: #fff; color: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border-color: #c9d8fb; }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn + .btn, .btn + form, form + .btn, form + form { margin-top: 8px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .btn { margin: 0; }

/* 칩·배지 */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary-dark); white-space: nowrap; }
.chip.gray { background: #eef1f5; color: var(--ink-2); }
.chip.red { background: var(--bad-soft); color: var(--bad); }
.chip.green { background: var(--good-soft); color: var(--good); }
.chip.on-hero { background: rgba(255, 255, 255, .18); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* 숫자 타일 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats.two { grid-template-columns: 1fr 1fr; }
.stat { background: var(--surface); border-radius: 12px; padding: 12px; }
.card .stat { background: #f6f8fb; }
.stat .label { font-size: 12px; color: var(--ink-2); }
.stat .value { font-size: 20px; font-weight: 700; }
.stat .value small { font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* 진행 바 */
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 0 3px 3px 0; }
.hero .progress { background: rgba(255, 255, 255, .25); }
.hero .progress > span { background: #fff; }

/* 문항 화면 */
.q-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; font-size: 14px; color: var(--ink-2); }
.q-text { font-size: 19px; font-weight: 700; line-height: 1.5; margin: 14px 0 4px; }
.ox { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 16px; }
.ox input { position: absolute; opacity: 0; pointer-events: none; }
.ox label { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 104px; border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; color: var(--ink-2); user-select: none; }
.ox label b { font-size: 40px; line-height: 1; }
.ox label span { font-size: 13px; margin-top: 6px; }
.ox input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.ox input:focus-visible + label { outline: 3px solid #93c5fd; outline-offset: 2px; }
.hint { background: var(--warn-soft); border-radius: 12px; padding: 0 14px; font-size: 14px; }
.hint summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.hint p { padding-bottom: 12px; margin: 0; }

.feedback { border-radius: 14px; padding: 16px; margin: 16px 0; }
.feedback.correct { background: var(--good-soft); }
.feedback.wrong { background: var(--bad-soft); }
.feedback .verdict { font-size: 18px; font-weight: 800; }
.feedback.correct .verdict { color: var(--good); }
.feedback.wrong .verdict { color: var(--bad); }
.explain { background: #fff; border-radius: 12px; padding: 14px; margin-top: 12px; font-size: 15px; }
.source { font-size: 12px; color: var(--ink-2); margin-top: 8px; }

/* 결과 화면 */
.score-ring { width: 148px; height: 148px; border-radius: 50%; margin: 8px auto 12px; display: grid; place-items: center;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .25) 0); }
.score-ring > div { width: 124px; height: 124px; border-radius: 50%; background: #2360e6; display: grid; place-items: center; text-align: center; }
.score-ring b { font-size: 40px; line-height: 1; }
.score-ring small { display: block; font-size: 13px; opacity: .85; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 800; flex: none; }
.mark.ok { background: var(--good-soft); color: var(--good); }
.mark.ng { background: var(--bad-soft); color: var(--bad); }

/* 영역별 막대 (한 가지 색, 막대 끝만 둥글게) */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 92px 1fr 52px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.bars .name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 12px; background: var(--bar-track); border-radius: 0 4px 4px 0; position: relative; }
.bars .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.bars li.weak .fill { background: var(--bar-weak); }
.bars .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.bars li.nodata .val { color: var(--muted); }
.legend-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* 필터 탭 */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tabs a { flex: none; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: 13px; }
.tabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 폼 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; background: #fff; }
.field input:focus, .field select:focus { outline: 2px solid #93c5fd; border-color: var(--primary); }
.helptext, .field .help { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-bottom: 10px; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--bad); font-size: 13px; }
.form-errors { background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.field ul:not(.errorlist) { padding-left: 18px; margin: 4px 0; font-size: 12px; color: var(--muted); }

/* 알림 메시지 */
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li { padding: 12px 14px; border-radius: 12px; font-size: 14px; background: var(--primary-soft); color: var(--primary-dark); margin-bottom: 6px; }
.messages li.success { background: var(--good-soft); color: var(--good); }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); color: #8a5a00; }

/* 하단 탭 메뉴 */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.bottom-nav .inner { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; font-size: 12px; color: var(--muted); text-decoration: none; }
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a.on { color: var(--primary); font-weight: 700; }

/* 랜딩 */
.landing-hero { padding: 40px 4px 24px; }
.landing-hero h1 { font-size: 28px; letter-spacing: -0.5px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.footer { text-align: center; font-size: 12px; color: var(--muted); margin: 28px 0 8px; }
.footer a { color: var(--muted); }

.pagination { display: flex; justify-content: center; gap: 12px; margin: 16px 0; font-size: 14px; }
.legal h2 { margin-top: 20px; }
.legal { font-size: 14px; }
