/* 정보시스템감리사 기출 학습 사이트 — 공통 스타일 */
:root {
  --paper: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --ink: #1c2330;
  --ink-2: #4b5565;
  --ink-3: #7a8494;
  --line: #d9d4c7;
  --accent: #1f3a6e;
  --accent-soft: #e4eaf6;
  --accent-ink: #ffffff;
  --ok: #1d7a4c;
  --ok-soft: #e2f3ea;
  --bad: #b3372f;
  --bad-soft: #f9e6e3;
  --warn: #9a6a00;
  --warn-soft: #fbf1d6;
  --radius: 10px;
  --sans: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --serif: "Noto Serif KR", "AppleMyungjo", "Nanum Myeongjo", "Batang", serif;
  --mono: "D2Coding", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14171d; --surface: #1c2028; --surface-2: #252a34; --ink: #e8eaee; --ink-2: #b3bac6;
    --ink-3: #828b9a; --line: #353b47; --accent: #8fb0ee; --accent-soft: #24304a; --accent-ink: #10151f;
    --ok: #62c795; --ok-soft: #1b3529; --bad: #ef8a80; --bad-soft: #3d2220; --warn: #e3b955; --warn-soft: #3a3015;
  }
}
:root[data-theme="dark"] {
  --paper: #14171d; --surface: #1c2028; --surface-2: #252a34; --ink: #e8eaee; --ink-2: #b3bac6;
  --ink-3: #828b9a; --line: #353b47; --accent: #8fb0ee; --accent-soft: #24304a; --accent-ink: #10151f;
  --ok: #62c795; --ok-soft: #1b3529; --bad: #ef8a80; --bad-soft: #3d2220; --warn: #e3b955; --warn-soft: #3a3015;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.7;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.35; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; margin-top: 3rem; padding-bottom: .5rem; border-bottom: 2px solid var(--ink); }
h3 { font-size: 1.08rem; margin-top: 1.6rem; font-family: var(--sans); font-weight: 700; }
p { margin: .7rem 0; }
small, .small { font-size: .86rem; color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 헤더 */
.site-header {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.site-header .inner { max-width: 1080px; margin: 0 auto; padding: .6rem 1.2rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--ink-3); font-family: var(--sans); font-weight: 400; font-size: .8rem; margin-left: .4rem; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink-2); padding: .4rem .8rem; border-radius: 999px; font-size: .93rem; font-weight: 600;
}
.nav a b { font-weight: 700; color: var(--ink-3); margin-right: .3rem; font-variant-numeric: tabular-nums; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav a[aria-current="page"] b { color: inherit; opacity: .7; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .3rem .7rem; font-size: .82rem; cursor: pointer; }

main { max-width: 1080px; margin: 0 auto; padding: 2rem 1.2rem 5rem; }
.narrow { max-width: 760px; }
.eyebrow { font-size: .8rem; letter-spacing: .12em; color: var(--ink-3); font-weight: 700; text-transform: uppercase; }
.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 62ch; }
.site-footer { border-top: 1px solid var(--line); color: var(--ink-3); font-size: .84rem; }
.site-footer .inner { max-width: 1080px; margin: 0 auto; padding: 1.4rem 1.2rem 2.4rem; }

/* 공통 블록 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.grid { display: grid; gap: 1rem; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { border-top: 3px solid var(--ink); padding-top: .7rem; }
.stat .v { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .86rem; color: var(--ink-2); }
.note { background: var(--warn-soft); border-left: 4px solid var(--warn); padding: .8rem 1rem; border-radius: 6px; font-size: .93rem; }
.note.info { background: var(--accent-soft); border-left-color: var(--accent); }
.tag { display: inline-block; font-size: .76rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: .55rem 1.1rem; border-radius: 8px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: .95rem;
}
.btn:hover { opacity: .88; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); opacity: 1; }
.btn.sm { padding: .3rem .7rem; font-size: .84rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); font-size: .82rem; color: var(--ink-2); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 700; white-space: nowrap; }

/* 절차 스텝 */
.steps { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; font-size: .9rem; }
.steps li::before { content: counter(s, decimal-leading-zero); display: block; font-family: var(--serif); font-weight: 700; color: var(--accent); font-size: 1.1rem; }
.steps li b { display: block; }
.steps li span { color: var(--ink-2); font-size: .84rem; }

/* 타임라인 */
.timeline { list-style: none; margin: 1rem 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.3rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .5rem; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.timeline li.key::before { background: var(--accent); }
.timeline time { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline span { color: var(--ink-2); font-size: .92rem; }

details.acc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: .6rem 0; }
details.acc > summary { cursor: pointer; padding: .8rem 1rem; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; color: var(--ink-3); }
details.acc[open] > summary::after { content: "–"; }
details.acc > div { padding: 0 1rem 1rem; }
details.acc ul { margin: .3rem 0; padding-left: 1.2rem; }
details.acc li { margin: .15rem 0; font-size: .93rem; }

/* 막대 차트 */
.bars { display: grid; gap: .45rem; margin: .8rem 0; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 15rem) 1fr 2.6rem; gap: .7rem; align-items: center; font-size: .88rem; }
.bar-track { background: var(--surface-2); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* 도구 막대 */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.2rem 0; }
.toolbar select, .toolbar input[type="search"] { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: .45rem .7rem; }
.toolbar input[type="search"] { flex: 1 1 200px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .3rem .85rem; font-size: .88rem; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; cursor: pointer; }

/* 문항 카드 */
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; margin: 1rem 0; }
.q-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; }
.q-no { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; margin-right: .3rem; font-variant-numeric: tabular-nums; }
.q-stem { font-size: 1.02rem; font-weight: 600; white-space: pre-wrap; }
.q-box { border: 1px solid var(--ink-3); border-radius: 4px; padding: .7rem .9rem; margin: .7rem 0; white-space: pre-wrap; font-size: .95rem; background: var(--paper); overflow-x: auto; }
.q-box.mono { font-family: var(--mono); font-size: .86rem; line-height: 1.55; white-space: pre; }
.q-img { margin: .7rem 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .6rem; max-width: 560px; }
.q-img img { display: block; max-width: 100%; height: auto; }
.q-img figcaption { font-size: .78rem; color: #666; margin-top: .3rem; }
.choices { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .35rem; }
.choice {
  display: grid; grid-template-columns: 1.7rem 1fr; gap: .4rem; align-items: start; width: 100%; text-align: left;
  border: 1px solid transparent; background: transparent; border-radius: 8px; padding: .4rem .6rem; white-space: pre-wrap;
}
button.choice { cursor: pointer; border-color: var(--line); background: var(--surface); }
button.choice:hover:not(:disabled) { background: var(--surface-2); }
.choice .mk { font-weight: 700; color: var(--ink-3); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.selected .mk { color: var(--accent); }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.correct .mk { color: var(--ok); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.wrong .mk { color: var(--bad); }
.choice .why { grid-column: 2; font-size: .86rem; color: var(--ink-2); font-weight: 400; }
.explain { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: 1rem; }
.explain h4 { margin: 0 0 .3rem; font-size: .8rem; letter-spacing: .08em; color: var(--ink-3); }
.explain p { white-space: pre-wrap; margin: .2rem 0 .9rem; font-size: .96rem; }
.keypoint { background: var(--accent-soft); border-radius: 6px; padding: .6rem .8rem; font-size: .93rem; margin-bottom: .9rem; white-space: pre-wrap; }
.sources { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: var(--ink-2); }
.sources li { margin: .15rem 0; }
.q-foot { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; align-items: center; }
.hidden { display: none !important; }

/* 정답표 */
.answer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .35rem; }
.answer-grid a { display: flex; justify-content: space-between; gap: .3rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: .86rem; font-variant-numeric: tabular-nums; }
.answer-grid a b { color: var(--accent); }
.answer-grid a:hover { background: var(--surface-2); }

/* 모의고사 */
.mode-card { display: flex; flex-direction: column; gap: .5rem; }
.mode-card h3 { margin: 0; font-family: var(--serif); font-size: 1.2rem; }
.mode-card .btn { margin-top: auto; align-self: flex-start; }
.mode-card .tag { align-self: flex-start; }
select { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: .45rem .7rem; }
input[type="checkbox"] { accent-color: var(--accent); }
.field { display: grid; gap: .3rem; margin: .8rem 0; }
.field > label, .field > .label { font-size: .86rem; font-weight: 700; color: var(--ink-2); }
.checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.checks label { font-size: .92rem; display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
.exam-bar {
  position: sticky; top: 53px; z-index: 15; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem 1rem; display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1rem; box-shadow: 0 4px 14px rgb(0 0 0 / .06);
}
.exam-bar .timer { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 5.5ch; }
.exam-bar .timer.low { color: var(--bad); }
.exam-bar .spacer { flex: 1; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; flex: 1 1 140px; min-width: 100px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; }
.omr { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: .3rem; margin: .5rem 0; }
.omr button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: .25rem 0; font-size: .8rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.omr button.done { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.omr button.cur { outline: 2px solid var(--ink); }
.omr button.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.omr button.no { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.omr-sub { font-size: .78rem; font-weight: 700; color: var(--ink-3); margin-top: .6rem; }
.score-big { font-family: var(--serif); font-size: 3rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result-row { display: grid; grid-template-columns: minmax(110px, 12rem) 1fr 7.5rem; gap: .7rem; align-items: center; font-size: .92rem; margin: .4rem 0; }
.result-row .bar-fill.fail { background: var(--bad); }
.result-row .n { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .q { padding: 1rem; }
  .bar-row { grid-template-columns: 1fr 2.4rem; }
  .bar-row .bar-track { grid-column: 1 / -1; order: 3; }
  .result-row { grid-template-columns: 1fr 7rem; }
  .result-row .bar-track { grid-column: 1 / -1; order: 3; }
  .exam-bar { top: 0; position: static; }
}
@media print {
  .site-header, .toolbar, .q-foot, .theme-btn, .exam-bar { display: none !important; }
  body { background: #fff; }
  .q { break-inside: avoid; }
}
