:root {
  --ink: #17142b;
  --muted: #55526b;
  --line: #dcd9ea;
  --bg: #ffffff;
  --soft: #f6f5fd;
  --purple: #5b3fd1;
  --purple-dark: #452fa6;
  --pass: #157a3c;
  --pass-bg: #e8f6ee;
  --fail: #b42318;
  --fail-bg: #fdecea;
  --focus: #f0a400;
  font-size: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top { border-bottom: 1px solid var(--line); background: var(--soft); }
.top-inner { display: flex; gap: 12px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.mascot { flex: none; }
h1 { font-size: 1.3rem; margin: 0; line-height: 1.35; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
.meta { margin: 2px 0 0; color: var(--purple-dark); font-weight: 700; }
main { padding-top: 16px; padding-bottom: 32px; }
main:focus { outline: none; }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 0 0 16px; background: #fff; }
.notice:empty { display: none; }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.notice.error { background: var(--fail-bg); border-color: #f3b8b2; color: #7a1a12; }

.field { margin-bottom: 16px; }
label { font-weight: 700; display: block; margin-bottom: 4px; }
input[type="text"], input[type="tel"], input[type="date"], input[type="password"], input[type="search"] {
  width: 100%; max-width: 420px; min-height: 48px; padding: 8px 12px;
  font-size: 1rem; color: var(--ink); background: #fff;
  border: 2px solid #b9b5d0; border-radius: 8px;
}
input[aria-invalid="true"] { border-color: var(--fail); }
.hint { color: var(--muted); font-size: 0.92rem; margin: 4px 0 0; }
.field-error { color: var(--fail); font-weight: 700; margin: 4px 0 0; }
.field-error:empty { display: none; }

.privacy { background: var(--soft); border-radius: 10px; padding: 16px; margin: 8px 0 16px; }
.privacy dl { display: grid; grid-template-columns: 6.5em 1fr; gap: 4px 12px; margin: 0 0 8px; }
.privacy dt { font-weight: 700; }
.privacy dd { margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; cursor: pointer; padding: 8px 0; }
.check input { width: 26px; height: 26px; flex: none; margin: 2px 0 0; accent-color: var(--purple); }

.btn {
  min-height: 48px; min-width: 44px; padding: 10px 20px; font-size: 1rem; font-weight: 700;
  border-radius: 10px; border: 2px solid var(--purple); background: #fff; color: var(--purple-dark); cursor: pointer;
}
.btn.primary { background: var(--purple); color: #fff; }
.btn.primary:hover { background: var(--purple-dark); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 0.95rem; }

.exam-bar {
  position: sticky; top: 0; z-index: 2; background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 0; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center;
}
.exam-bar h2 { margin: 0; font-size: 1.1rem; }
.exam-bar p { margin: 0; font-weight: 700; }
.exam-bar progress { width: 160px; height: 14px; accent-color: var(--purple); }
.save-status { color: var(--muted); font-weight: 400 !important; font-size: 0.95rem; }
.save-status.error { color: var(--fail); font-weight: 700 !important; }

.qnav ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; }
.qnav a {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 2px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 700;
}
.qnav a.done { background: var(--purple); border-color: var(--purple); color: #fff; }
.qnav a.missing { border-color: var(--fail); color: var(--fail); }

fieldset.q { border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px 12px; margin: 0 0 16px; scroll-margin-top: 110px; }
fieldset.q.missing { border: 2px solid var(--fail); }
fieldset.q legend { font-weight: 700; font-size: 1.05rem; padding: 0 4px; }
.q-no { color: var(--purple-dark); margin-right: 6px; }
.opt { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; padding: 10px 12px; margin: 6px 0; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; min-height: 48px; }
.opt input { width: 22px; height: 22px; flex: none; margin: 3px 0 0; accent-color: var(--purple); }
.opt:has(input:checked) { border-color: var(--purple); background: var(--soft); }
.submit-card { text-align: center; }

.result-card { text-align: left; }
.verdict { font-size: 2.2rem; font-weight: 800; margin: 0 0 4px; padding: 6px 16px; border-radius: 10px; display: inline-block; }
.verdict.pass { color: var(--pass); background: var(--pass-bg); }
.verdict.fail { color: var(--fail); background: var(--fail-bg); }
.score-line { font-size: 1.2rem; margin: 8px 0; }
.score { font-size: 2.4rem; font-weight: 800; }
.muted { color: var(--muted); }
.graph { width: 100%; max-width: 640px; height: auto; display: block; margin: 8px 0 16px; }
.counts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.next { font-weight: 700; font-size: 1.05rem; }
.history table { border-collapse: collapse; margin-top: 12px; }
.history th, .history td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; }

dialog { border: none; border-radius: 14px; padding: 24px; max-width: min(92vw, 440px); color: var(--ink); }
dialog::backdrop { background: rgba(23, 20, 43, 0.45); }
.actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

.foot { color: var(--muted); font-size: 0.9rem; padding-bottom: 24px; }

/* admin */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.admin-table th { background: var(--soft); }
.table-scroll { overflow-x: auto; }
.cell-address { min-width: 12em; max-width: 24em; white-space: normal; overflow-wrap: anywhere; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input { max-width: 280px; }
.tag { display: inline-block; padding: 0 8px; border-radius: 6px; font-weight: 700; }
.tag.pass { color: var(--pass); background: var(--pass-bg); }
.tag.fail { color: var(--fail); background: var(--fail-bg); }
.review-ok { color: var(--pass); font-weight: 700; }
.review-no { color: var(--fail); font-weight: 700; }

@media (max-width: 480px) {
  :root { font-size: 16px; }
  .card { padding: 14px; }
  .privacy dl { grid-template-columns: 1fr; }
  .privacy dt { margin-top: 6px; }
  .verdict { font-size: 1.8rem; }
  .mascot { width: 44px; height: 44px; }
}
@media print {
  .top, .foot, .btn, .qnav { display: none !important; }
}
