/* 수학클리닉 — 공통 스타일
   팔레트: 잉크 남색 / 청록(진단) / 호박(성장) / 벽돌(주의) / 차가운 흰 종이
   글꼴: Pretendard 한 가족, 굵기 대비로 위계를 만든다. */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css');

:root {
  --ink: #17233B;
  --ink-70: #4A566E;
  --ink-45: #7C869A;
  --rule: #D6DCE6;
  --paper: #F7F8FA;
  --card: #FFFFFF;
  --teal: #0E6E68;
  --teal-soft: #E4F0EE;
  --amber: #B4761A;
  --amber-soft: #FBF1DE;
  --clay: #A8443C;
  --clay-soft: #F8E9E7;
  --focus: #1B62C9;
  --r: 12px;
  --maxw: 1080px;
  --rail: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo',
               'Malgun Gothic', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  padding-left: var(--rail);
}
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; max-width: 68ch; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
small { font-size: .84rem; color: var(--ink-70); }

/* 헤더 */
.top {
  background: var(--ink); color: #fff;
  border-bottom: 3px solid var(--teal);
}
.top-in {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; color: #fff; text-decoration: none; }
.brand span { font-weight: 400; color: #A9BDD6; margin-left: 8px; font-size: .84rem; }
.nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: #D5E0EE; text-decoration: none; font-size: .92rem; padding: 2px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--teal); }

main { max-width: var(--maxw); margin: 0 auto; padding: 32px 28px 76px; }
.wrap-narrow { max-width: 760px; }
footer {
  border-top: 1px solid var(--rule); background: #fff;
  padding: 22px 20px; color: var(--ink-70); font-size: .86rem;
}
footer .fin { max-width: var(--maxw); margin: 0 auto; }

/* 접근성 중심 사이드바 */
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; transform: translateY(-150%); background: #fff; color: var(--ink); border: 2px solid var(--focus); border-radius: 8px; padding: 8px 12px; font-weight: 700; }
.skip-link:focus { transform: translateY(0); }
.side-rail { position: fixed; inset: 0 auto 0 0; z-index: 8; width: var(--rail); overflow-y: auto; background: #101b32; color: #fff; padding: 28px 16px 18px; border-right: 4px solid var(--teal); }
.side-rail::before { content: "∑  ∫  π  √  ≠"; display: block; color: rgba(184, 230, 222, .22); font-size: 1.15rem; letter-spacing: .48rem; white-space: nowrap; overflow: hidden; margin: 0 4px 24px; }
.side-rail-title { color: #b8e6de; text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 800; margin: 0 8px 9px; }
.side-rail nav { display: grid; gap: 4px; }
.side-rail nav a { display: grid; grid-template-columns: 32px 1fr; gap: 8px; padding: 11px 10px; color: #dbe8f7; text-decoration: none; border: 1px solid transparent; border-radius: 9px; }
.side-rail nav a:hover, .side-rail nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(184,230,222,.42); }
.side-rail nav b { color: #72d2c4; font-size: .72rem; line-height: 1.65; }
.side-rail nav span { font-size: .91rem; font-weight: 700; line-height: 1.35; }
.side-rail nav small { display: block; color: #9eb1cb; font-size: .73rem; font-weight: 400; margin-top: 3px; }
.side-rail-help { margin: 24px 6px 0; padding: 13px 12px; border-left: 2px solid var(--amber); background: rgba(255,255,255,.06); color: #d5e0ee; font-size: .79rem; line-height: 1.55; }
.side-rail-help b, .side-rail-help span { display: block; }
.side-rail-help b { color: #f6d597; margin-bottom: 3px; }

/* 히어로: 모눈 여백 위의 한 줄 */
.hero { padding: 34px 0 26px; border-bottom: 1px solid var(--rule); margin-bottom: 28px;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px),
                    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 26px 26px; background-position: -1px -1px;
  background-blend-mode: normal; }
.hero-home { position: relative; min-height: 34svh; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem) 2rem; overflow: hidden; border-radius: 0 0 22px 22px; background-color: #eef6f7; background-image: radial-gradient(circle at 82% 22%, rgba(14,110,104,.18) 0 2px, transparent 3px), radial-gradient(circle at 78% 55%, rgba(27,98,201,.12) 0 1px, transparent 2px), linear-gradient(rgba(14,110,104,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(14,110,104,.1) 1px, transparent 1px), linear-gradient(135deg, #f8fcfc, #e5f0f2); background-size: 96px 96px, 64px 64px, 32px 32px, 32px 32px, auto; }
.hero-home::before { content: "∑  π  x²  √  ∫  f(x)  θ  ≈"; position: absolute; right: -1.5rem; top: 1rem; max-width: 52%; color: rgba(23,35,59,.1); font-family: Georgia, serif; font-size: clamp(2.6rem, 7vw, 6.5rem); line-height: 1.35; letter-spacing: .22em; transform: rotate(-8deg); }
.hero-home .hero-in, .hero-home .cycle { position: relative; z-index: 1; }
.hero-in { background: var(--paper); display: inline-block; padding-right: 12px; }
.hero-home .hero-in { background: linear-gradient(90deg, rgba(238,246,247,.82) 0%, rgba(238,246,247,.62) 58%, rgba(238,246,247,0) 100%); padding: 18px 26px 18px 0; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); max-width: 24ch; }
.hero p { font-size: 1.05rem; color: var(--ink-70); }
.hero-home .hero-label { color: var(--teal); font-size: .88rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 .4rem; }
.hero-home h1 { max-width: 14ch; color: var(--ink); font-size: clamp(4rem, 10vw, 8.5rem); line-height: .92; letter-spacing: -.08em; }
.hero-home .hero-copy { max-width: 55ch; font-size: clamp(1rem, 1.6vw, 1.18rem); margin-top: 1rem; }
.home-main { max-width: none; padding: 0 0 76px; }
.home-main .hero-home { min-height: calc(100svh - 64px); margin: 0; border-radius: 0; padding: clamp(2.5rem, 7vw, 6.5rem) max(28px, calc((100% - var(--maxw)) / 2)) 2.5rem; }
.home-main .hero-home .hero-in, .home-main .hero-home .cycle { width: min(100%, var(--maxw)); margin-inline: auto; }
.home-main .hero-home .cycle { margin-top: 2.5rem; }
.home-main > .split { max-width: var(--maxw); margin: 34px auto 0; padding-inline: 28px; }

/* 순환 단계 */
.cycle { display: flex; flex-wrap: wrap; gap: 0; margin: 18px 0 0; padding: 0; list-style: none;
  border-top: 2px solid var(--ink); }
.cycle li { padding: 10px 16px 10px 0; margin-right: 16px; font-size: .9rem; color: var(--ink-70);
  border-right: 1px solid var(--rule); }
.cycle li b { display: block; color: var(--ink); font-size: .95rem; }
.cycle li:last-child { border-right: 0; }

/* 카드 */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px 20px; }
.card h3 { margin-bottom: .3em; }
.card p { font-size: .93rem; color: var(--ink-70); margin-bottom: .5em; }
.card.pick { border-left: 4px solid var(--teal); }

/* 폼 */
label { display: block; font-weight: 600; font-size: .93rem; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--rule); border-radius: var(--r);
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 82px; resize: vertical; }
input.code-in { box-sizing: border-box; max-width: 100%; font-size: 1.35rem; letter-spacing: .22em; text-align: center; text-transform: uppercase; font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  background: var(--teal); color: #fff; border: 1px solid var(--teal); border-radius: var(--r);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #0B5A55; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { background: #EEF1F5; }
.btn.small { padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

/* 문항 */
.qblock { background: #fff; border: 1px solid var(--rule); border-radius: var(--r); margin: 0 0 12px; }
.qblock-head { padding: 12px 18px; border-bottom: 1px solid var(--rule); background: #FCFDFE; }
.qblock-head b { font-size: .95rem; }
.qblock-head small { display: block; }
.q { padding: 12px 18px; border-bottom: 1px solid #EDF0F4; }
.q:last-child { border-bottom: 0; }
.q .qt { font-size: .97rem; margin-bottom: 8px; }
.q .qt i { color: var(--ink-45); font-style: normal; font-size: .82rem; margin-right: 6px; }
.opts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.opts label {
  margin: 0; font-weight: 400; font-size: .8rem; text-align: center; color: var(--ink-70);
  border: 1px solid var(--rule); border-radius: var(--r); padding: 8px 4px; cursor: pointer; background: #fff;
}
.opts input { position: absolute; opacity: 0; width: 0; height: 0; }
.opts label:has(input:checked) { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); font-weight: 600; }
.opts label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.q.unanswered { background: #FFFBF5; }

/* 자기점검 체크 */
.checks { display: grid; gap: 8px; }
.chk { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--rule);
  border-radius: var(--r); padding: 11px 14px; font-weight: 400; margin: 0; cursor: pointer; }
.chk:has(input:checked) { border-color: var(--amber); background: var(--amber-soft); }
.chk input { margin-top: 4px; }
.chk .meta { display: block; font-size: .8rem; color: var(--ink-45); margin-top: 2px; }

/* 결과 바 */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 46px; gap: 10px; align-items: center; font-size: .9rem; }
.bar { height: 12px; background: #EAEEF3; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--teal); }
.bar.neg i { background: var(--clay); }
.bar-val { text-align: right; font-weight: 700; font-size: .88rem; }

/* 표 */
table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { background: #F0F3F7; font-size: .84rem; font-weight: 700; position: sticky; top: 0; }
tbody tr:hover { background: #FAFCFE; }
.tscroll { max-height: 60vh; overflow: auto; border: 1px solid var(--rule); border-radius: var(--r); }
.priority-table { table-layout: fixed; min-width: 820px; }
.priority-table th, .priority-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.priority-table th:nth-child(1){width:62px}.priority-table th:nth-child(2){width:58px}.priority-table th:nth-child(3){width:74px}.priority-table th:nth-child(4),.priority-table th:nth-child(5),.priority-table th:nth-child(6){width:45px}.priority-table th:nth-child(7){width:112px}.priority-table th:nth-child(8){width:36px}.priority-table th:nth-child(10){width:64px}
.priority-table .warning-cell { white-space: normal; overflow: visible; text-overflow: clip; }
.priority-table .action-cell { position: sticky; right: 0; background: #fff; padding-inline: 6px; }
.priority-table tr:hover .action-cell { background: #FAFCFE; }
.info-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
@media (max-width:520px){.info-grid{grid-template-columns:1fr}}

/* 배지·알림 */
.tag { display: inline-block; font-size: .76rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: #EDF0F4; color: var(--ink-70); }
.tag.warn { background: var(--clay-soft); color: var(--clay); }
.tag.ok { background: var(--teal-soft); color: var(--teal); }
.tag.grow { background: var(--amber-soft); color: var(--amber); }
.note { border-left: 3px solid var(--teal); background: var(--teal-soft); padding: 12px 16px; border-radius: 0 var(--r) var(--r) 0; margin: 16px 0; }
.note.warn { border-color: var(--clay); background: var(--clay-soft); }
.note.plain { border-color: var(--rule); background: #fff; }
.note p:last-child { margin-bottom: 0; }

/* 진행 */
.steps { display: flex; gap: 6px; list-style: none; padding: 3px 0 10px; margin: 0 0 12px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--teal) transparent; font-size: .85rem; }
.steps li { flex: 0 0 auto; white-space: nowrap; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 99px; color: var(--ink-45); background: #fff; }
.steps li.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.steps li.done { border-color: var(--teal); color: var(--teal); }
.prog { height: 4px; background: #E5EAF0; border-radius: 99px; margin-bottom: 18px; }
.prog i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .25s; }

/* 결과 시각화 */
.result-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.result-overview .metric { padding: 16px; border-radius: var(--r); border: 1px solid var(--rule); background: #fff; }
.result-overview .metric b { display: block; font-size: 1.65rem; line-height: 1.1; color: var(--teal); }
.result-overview .metric span { color: var(--ink-70); font-size: .83rem; }
.profile-card { background: linear-gradient(135deg, #13213b, #174f52); color: #fff; border-radius: var(--r); padding: 22px; margin: 20px 0; }
.profile-card h2 { color: #fff; font-size: 1.08rem; }
.profile-card p { color: #d6efeb; font-size: .93rem; }
.profile-card .bar { background: rgba(255,255,255,.16); }
.profile-card .bar i { background: #8ce2d7; }
.profile-card .bar-row { grid-template-columns: 120px 1fr 44px; }
.profile-card .bar-row > span:first-child, .profile-card .bar-val { color: #fff; }

.hide { display: none !important; }
.split { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 1060px) { body { padding-left: 0; } .side-rail { position: static; width: auto; padding: 10px 20px; border-right: 0; border-bottom: 3px solid var(--teal); } .side-rail::before, .side-rail-title, .side-rail-help { display: none; } .side-rail nav { display: flex; overflow-x: auto; gap: 6px; } .side-rail nav a { flex: 0 0 auto; display: block; padding: 7px 10px; border-color: rgba(184,230,222,.28); } .side-rail nav b { display: none; } .side-rail nav small { display: none; } }
@media (max-width: 860px) { main { padding: 24px 18px 64px; } .home-main { padding: 0 0 64px; } .split { grid-template-columns: 1fr; } .bar-row { grid-template-columns: 110px 1fr 42px; } .home-main .hero-home { min-height: calc(100svh - 111px); margin: 0; padding: clamp(2.5rem, 12vw, 5rem) 18px 2rem; } .home-main > .split { margin-top: 28px; padding-inline: 18px; } .result-overview { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .top-in { padding: 11px 16px; } .brand span { display: none; } .nav { margin-left: 0; gap: 12px; } .nav a { font-size: .83rem; } .hero-home h1 { font-size: clamp(3.7rem, 19vw, 5.6rem); } .hero-home::before { max-width: 62%; top: 1.5rem; } .opts { grid-template-columns: repeat(5, 1fr); gap: 3px; } .opts label { font-size: .68rem; padding: 8px 2px; } .bar-row, .profile-card .bar-row { grid-template-columns: 84px 1fr 38px; gap: 6px; } }
@media print { .top, footer, .noprint { display: none; } body { background: #fff; } .card { break-inside: avoid; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
