/* hakwon.manuz.com — 학습지·노트: 크림 종이, 괘선 카드, 연필 노랑 포스트잇, 형광펜 표 머리, 빨간 펜 채점.
   글꼴: IBM Plex Sans KR(본문·숫자) + Nanum Pen Script(손글씨 메모). 다크모드 없음(종이 한 장). 모바일 390px 기준. */
:root {
  --paper: #f8f2e2;          /* 바탕 크림 */
  --sheet: #fffdf6;          /* 카드 종이 */
  --kraft: #ebe1c8;          /* 발·표지 */
  --rule: #d7e2ee;           /* 괘선 파랑 */
  --margin: #e9a6a0;         /* 여백선 빨강 */
  --ink: #2a2822;            /* 연필심 */
  --ink-2: #57524a;
  --muted: #8a8374;
  --line: #e2d8bf;
  --pencil: #f6c431;         /* 연필 노랑 */
  --pencil-2: #ffe27a;       /* 포스트잇 */
  --hl: #fff09a;             /* 형광펜 */
  --red: #c8432b;            /* 빨간 펜 */
  --blue: #2f5d8a;           /* 파란 펜(링크) */
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --pen: "Nanum Pen Script", "IBM Plex Sans KR", cursive;
  --wrap: 920px;
  --lh: 28px;                /* 괘선 간격 */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--sans); font-size: 16px; line-height: 1.7; color: var(--ink);
  background: var(--paper);
  word-break: keep-all; overflow-wrap: anywhere;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: 16px; }
.skip { position: absolute; left: -9999px; top: 10px; z-index: 100; background: var(--ink); color: var(--pencil); padding: 10px 14px; font-weight: 700; }
.skip:focus { left: 10px; }
.small { font-size: .86rem; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 머리: 노트 표지 — 연필 노랑 띠 + 색인 탭 메뉴 */
.mast { background: var(--sheet); border-bottom: 4px solid var(--pencil); box-shadow: 0 1px 0 var(--ink); }
.mast-in { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding-block: 8px 0; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.wm-icon { width: 30px; height: 30px; flex: none; }
.wm-text { font-size: 1.08rem; }
.nav { display: flex; gap: 4px; margin-left: auto; align-self: flex-end; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border: 1.5px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0;
  background: var(--paper); font-size: .9rem; text-decoration: none; color: var(--ink-2);
}
.nav a:hover { background: var(--hl); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--pencil); color: var(--ink); font-weight: 700; }
@media (max-width: 640px) {
  .nav { margin-left: 0; width: 100%; }
  .nav a { flex: 1 1 0; justify-content: center; padding: 0 6px; font-size: .86rem; }
}

.main { flex: 1; padding-block: 18px 44px; }

/* 빵부스러기: 연필 메모 */
.crumbs ol { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; align-items: center; font-size: .86rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 6px; color: var(--line); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); text-underline-offset: 3px; }

/* 제목: 단원명 + 형광펜 */
.hero { padding: 6px 0 16px; }
.eyebrow { margin: 0 0 4px; font-family: var(--pen); font-size: 1.35rem; line-height: 1.2; color: var(--red); }
.h1 { margin: 0; font-size: clamp(1.55rem, 2.4vw + 1rem, 2.2rem); line-height: 1.3; letter-spacing: -.03em; font-weight: 700; }
.h1-sub { display: block; margin-top: 6px; font-size: .92rem; font-weight: 400; letter-spacing: 0; color: var(--ink-2); }
.lead { margin: 10px 0 0; max-width: 640px; color: var(--ink-2); }
.lead b, .prose li b { background: linear-gradient(transparent 58%, var(--hl) 58%); color: var(--ink); }

/* 핵심 숫자: 포스트잇 */
.res { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 4px; }
.res-card { position: relative; min-width: 0; padding: 14px 14px 12px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--line); }
.res-card--main {
  grid-column: 1 / -1; padding: 22px 18px 16px; background: var(--pencil-2); border: 0; border-radius: 2px;
  box-shadow: 0 10px 14px -10px rgba(60, 45, 0, .45); transform: rotate(-.8deg);
}
.res-card--main::before { /* 테이프 */
  content: ""; position: absolute; top: -9px; left: 50%; width: 84px; height: 20px; margin-left: -42px;
  background: rgba(255, 255, 255, .55); border: 1px solid rgba(0, 0, 0, .06); transform: rotate(2deg);
}
.res-label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.res-n { font-weight: 400; color: var(--muted); margin-left: 4px; }
.res-value { margin-top: 2px; font-size: 1.45rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.res-card--main .res-value { font-size: clamp(2.4rem, 7vw + 1rem, 3.2rem); line-height: 1.05; }
.res-sub { margin-top: 4px; font-size: .84rem; color: var(--ink-2); }
.res-card--main .res-sub { font-family: var(--pen); font-size: 1.3rem; line-height: 1.25; color: var(--ink); }
.res-card--main + .res-card:last-child { grid-column: 1 / -1; }
@media (min-width: 720px) { .res { grid-template-columns: repeat(3, 1fr); } .res-card--main { grid-column: span 2; } .res-card--main + .res-card:last-child { grid-column: auto; } }

/* 광고 자리: 밀림 방지 */
.ad { min-height: 280px; margin: 26px 0; padding: 8px 0; border-block: 1px dashed var(--line); }

/* 본문 */
.prose { max-width: 700px; margin-top: 22px; }
.prose--wide { max-width: none; }
.prose h2, .faq h2, .related h2, .src-block h2 {
  display: flex; align-items: baseline; gap: 8px; margin: 34px 0 10px; font-size: 1.22rem; letter-spacing: -.02em; line-height: 1.4;
}
.prose h2::before { content: ""; flex: none; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; background: var(--pencil); transform: translateY(1px); }
.prose--wide > h2:first-child { margin-top: 6px; }
.prose h2 small { font-size: .82rem; font-weight: 400; color: var(--muted); }
.prose h3 { font-size: 1.04rem; margin: 22px 0 6px; }
.prose p, .prose li { color: var(--ink-2); }
.prose p { margin: 8px 0; }
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin: 4px 0; }
.prose b { color: var(--ink); }
.prose a:not([class]), td a, th a, .note-box a, .src a, .small a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* 해설: 괘선 노트(왼쪽 빨간 여백선) */
ul.notes {
  margin: 14px 0 0; padding: 4px 14px 4px 40px; list-style: none;
  background: var(--sheet) repeating-linear-gradient(transparent 0 calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px) var(--lh));
  background-position: 0 4px;
  border: 1.5px solid var(--ink); border-radius: 4px; position: relative;
}
.notes::before { content: ""; position: absolute; top: 0; bottom: 0; left: 26px; border-left: 2px solid var(--margin); }
.notes li { position: relative; margin: 0; padding: 0; line-height: var(--lh); color: var(--ink); font-size: .95rem; }
.notes li::before { content: "✎"; position: absolute; left: -34px; color: var(--muted); font-size: .8rem; }
.note-box { margin: 12px 0; padding: 12px 14px; background: var(--hl); border-left: 4px solid var(--pencil); font-size: .93rem; color: var(--ink); }

/* 입력: 학습지 빈칸 */
.calc {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px;
  padding: 18px 16px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 4px 4px 0 var(--pencil);
}
.field label { display: block; margin-bottom: 4px; font-size: .86rem; font-weight: 600; color: var(--ink); }
.field label .n { font-weight: 400; color: var(--muted); }
.field select, .field input {
  width: 100%; height: 48px; padding: 0 10px; font: inherit; font-size: 1.1rem; color: var(--ink);
  background: transparent; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; appearance: none; -webkit-appearance: none;
}
.field select { padding-right: 30px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%232a2822'%3E%3Cpath d='M5.5 7.5l4.5 4.5 4.5-4.5'/%3E%3C/svg%3E") no-repeat right 4px center / 18px; }
.field select:disabled { color: var(--muted); border-bottom-style: dashed; }
.field input:focus, .field select:focus { outline: none; border-bottom-color: var(--red); background-color: var(--hl); }
.field input::placeholder { color: #b9b09c; }
.field input[type=number] { -moz-appearance: textfield; }
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-wrap { position: relative; }
.unit-wrap input { padding-right: 56px; }
.unit { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-family: var(--pen); font-size: 1.35rem; color: var(--ink-2); pointer-events: none; }
.help { margin: 0; font-size: .82rem; color: var(--ink-2); line-height: 1.5; }
.field--wide { grid-column: 1 / -1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  font: inherit; font-weight: 700; color: var(--ink); text-decoration: none; background: var(--pencil);
  border: 2px solid var(--ink); border-radius: 6px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
}
.btn:hover { background: var(--pencil-2); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.cta-row { margin: 16px 0 0; }

/* 판정 결과: 빨간 펜 채점 */
.result { margin-top: 16px; }
.result:empty { display: none; }
.verdict { position: relative; padding: 16px 16px 14px 18px; background: var(--sheet); border: 2px solid var(--red); border-radius: 4px; color: var(--ink); }
.verdict::after { /* 채점 동그라미 */
  content: "확인"; position: absolute; top: -14px; right: 12px; padding: 2px 10px;
  font-family: var(--pen); font-size: 1.3rem; line-height: 1.2; color: var(--red); background: var(--paper);
  border: 2px solid var(--red); border-radius: 50%; transform: rotate(8deg);
}
.verdict b { display: block; padding-right: 54px; font-size: 1.12rem; line-height: 1.5; color: var(--red); }
.verdict p { margin: 6px 0 0; color: var(--ink); }
.prose .verdict p { color: var(--ink); }

/* 표: 형광펜 머리 + 괘선 줄 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 11px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--hl); color: var(--ink); font-weight: 700; font-size: .82rem; border-bottom: 1.5px solid var(--ink); }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #fffbe6; }
table th[scope=row] { font-weight: 600; }
td.l, th.l { text-align: left; white-space: normal; }
td b { font-size: 1.04rem; }
td .n, th .n { font-size: .74rem; color: var(--muted); font-weight: 400; }
td a, th a { display: inline-block; padding-block: 4px; }
.conf0 > *, .conf1 > * { color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border: 1.5px solid var(--ink); border-radius: 999px; font-size: .74rem; background: var(--pencil-2); color: var(--ink); }
.tag--off { border-color: var(--muted); background: transparent; color: var(--muted); }
@media (max-width: 559px) { .opt { display: none; } table th[scope=row] { white-space: normal; min-width: 7em; } }

/* 정렬 버튼·지역 칩: 색인 스티커 */
.sort { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.sort button, .chips a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  font: inherit; font-size: .92rem; color: var(--ink); text-decoration: none; background: var(--sheet);
  border: 1.5px solid var(--ink); border-radius: 6px; cursor: pointer;
}
.sort button[aria-pressed="true"] { background: var(--pencil); font-weight: 700; box-shadow: 2px 2px 0 var(--ink); }
.chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.prose .chips { padding-left: 0; }
.prose .chips a { color: var(--ink); text-decoration: none; }
.chips li { margin: 0; }
.chips a:hover { background: var(--hl); }
.chips a span { font-size: .78rem; color: var(--muted); }

/* 분포 막대: 연필 노랑 기둥 */
.hist { margin: 18px 0 8px; padding: 12px 10px 8px; background: var(--sheet) repeating-linear-gradient(90deg, transparent 0 19px, var(--rule) 19px 20px), repeating-linear-gradient(transparent 0 19px, var(--rule) 19px 20px); border: 1.5px solid var(--ink); border-radius: 4px; }
.hist svg { display: block; width: 100%; max-width: 640px; height: auto; }
.hist rect { fill: var(--pencil); stroke: var(--ink); stroke-width: 1.2; }
.hist text { fill: var(--ink-2); font-family: var(--sans); }
.hist .hist-n { font-size: 10px; font-weight: 700; fill: var(--ink); }
.hist .hist-x { font-size: 9px; }
.hist figcaption { margin-top: 6px; font-size: .84rem; color: var(--ink-2); }

/* 신고 원문: 줄 노트에 옮겨 적은 것 */
.rawfee {
  margin: 8px 0; padding: 4px 14px; font-size: .9rem; line-height: var(--lh); color: var(--ink); white-space: pre-wrap; word-break: break-all;
  background: var(--sheet) repeating-linear-gradient(transparent 0 calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px) var(--lh));
  background-position: 0 4px; border: 1.5px dashed var(--ink-2); border-radius: 4px;
}

/* FAQ: 단어 카드 */
.faq { margin-top: 30px; }
.faq details { margin: 8px 0; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 4px; }
.faq details[open] { box-shadow: 3px 3px 0 var(--pencil); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q"; flex: none; font-family: var(--pen); font-size: 1.5rem; line-height: 1; color: var(--red); }
.faq summary::after { content: "+"; margin-left: auto; flex: none; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq-a { padding: 0 14px 12px 40px; color: var(--ink-2); }

/* 업데이트 기록·출처 */
.changelog { list-style: none; padding: 0; }
.changelog li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.changelog time { font-family: var(--pen); font-size: 1.25rem; color: var(--red); margin-right: 6px; }
.related { margin-top: 34px; }
.src-block { margin-top: 36px; padding-top: 4px; border-top: 2px dashed var(--line); }
.src-block h2 { font-size: 1rem; }
.src { padding-left: 18px; font-size: .9rem; }
.src li { margin: 6px 0; }

/* 발: 크라프트 뒤표지 */
.foot { padding: 26px 0 34px; background: var(--kraft); border-top: 1.5px solid var(--ink); font-size: .84rem; color: var(--ink-2); }
.foot-brand { margin: 0 0 8px; font-weight: 700; color: var(--ink); }
.foot-note { margin: 4px 0; max-width: 720px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 10px 0 6px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.foot-copy { margin: 0; }
