/* =========================================================================
 * 인공지능 기초 웹교과서 — 공통 디자인 시스템
 * 2022 개정 교육과정 / 고등학교 진로 선택 '인공지능 기초'
 * ========================================================================= */

/* ---------- 1. 토큰 ---------- */
:root {
  --font-sans: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", "D2Coding", Consolas, "Courier New", monospace;

  --bg: #f7f8fb;
  --bg-soft: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #e9edf5;
  --line: #dfe4ee;
  --line-strong: #c6cee0;

  --ink: #16181d;
  --ink-2: #454b58;
  --ink-3: #6b7382;
  --ink-4: #98a0b0;

  --accent: #3b5bdb;
  --accent-ink: #2b45ad;
  --accent-soft: #e8ecfd;
  --accent-line: #b9c5f7;

  --ok: #128a5b;
  --ok-soft: #e2f6ed;
  --ok-line: #a6dfc6;
  --no: #c8354a;
  --no-soft: #fdeaed;
  --no-line: #f3bcc5;
  --warn: #a86400;
  --warn-soft: #fdf2dd;
  --warn-line: #efd49a;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 45, .05), 0 1px 3px rgba(20, 26, 45, .04);
  --shadow: 0 2px 4px rgba(20, 26, 45, .05), 0 8px 22px rgba(20, 26, 45, .07);
  --shadow-lg: 0 4px 10px rgba(20, 26, 45, .07), 0 20px 50px rgba(20, 26, 45, .12);

  --maxw: 940px;
  --maxw-wide: 1180px;
}

/* 영역별 강조색 */
[data-area="1"] { --accent: #3b5bdb; --accent-ink: #2942a8; --accent-soft: #e9edfd; --accent-line: #b8c4f7; }
[data-area="2"] { --accent: #0d8f7a; --accent-ink: #096b5c; --accent-soft: #e2f7f2; --accent-line: #9fdccf; }
[data-area="3"] { --accent: #b3541e; --accent-ink: #8c4116; --accent-soft: #fdeee2; --accent-line: #f0c3a3; }
[data-area="4"] { --accent: #7a44c9; --accent-ink: #5d33a0; --accent-soft: #f2eafd; --accent-line: #d3bcf3; }

/* ---------- 2. 다크 모드 ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101218;
    --bg-soft: #16191f;
    --surface: #1a1d25;
    --surface-2: #21242d;
    --surface-3: #2a2e39;
    --line: #313644;
    --line-strong: #454c5e;

    --ink: #eef0f5;
    --ink-2: #c2c8d4;
    --ink-3: #98a0b0;
    --ink-4: #737b8b;

    --accent: #8ba4ff;
    --accent-ink: #b3c3ff;
    --accent-soft: #1e2540;
    --accent-line: #3a4776;

    --ok: #56d0a0;
    --ok-soft: #142c24;
    --ok-line: #2a5f4b;
    --no: #ff8b9d;
    --no-soft: #33161d;
    --no-line: #6b2e3a;
    --warn: #e8b356;
    --warn-soft: #2e2416;
    --warn-line: #5d4823;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .34);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, .35), 0 20px 50px rgba(0, 0, 0, .45);
  }
  :root:not([data-theme="light"])[data-area="1"] { --accent: #8ba4ff; --accent-ink: #b0c1ff; --accent-soft: #1d2340; --accent-line: #3b4779; }
  :root:not([data-theme="light"])[data-area="2"] { --accent: #4ecfb4; --accent-ink: #86e2d0; --accent-soft: #122b27; --accent-line: #2b5f55; }
  :root:not([data-theme="light"])[data-area="3"] { --accent: #f0a866; --accent-ink: #f5c191; --accent-soft: #2f2016; --accent-line: #64432a; }
  :root:not([data-theme="light"])[data-area="4"] { --accent: #bd97f5; --accent-ink: #d3b8fa; --accent-soft: #251a3a; --accent-line: #4c3a75; }
}

:root[data-theme="dark"] {
  --bg: #101218;
  --bg-soft: #16191f;
  --surface: #1a1d25;
  --surface-2: #21242d;
  --surface-3: #2a2e39;
  --line: #313644;
  --line-strong: #454c5e;

  --ink: #eef0f5;
  --ink-2: #c2c8d4;
  --ink-3: #98a0b0;
  --ink-4: #737b8b;

  --accent: #8ba4ff;
  --accent-ink: #b3c3ff;
  --accent-soft: #1e2540;
  --accent-line: #3a4776;

  --ok: #56d0a0;
  --ok-soft: #142c24;
  --ok-line: #2a5f4b;
  --no: #ff8b9d;
  --no-soft: #33161d;
  --no-line: #6b2e3a;
  --warn: #e8b356;
  --warn-soft: #2e2416;
  --warn-line: #5d4823;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .34);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, .35), 0 20px 50px rgba(0, 0, 0, .45);
}
:root[data-theme="dark"][data-area="1"] { --accent: #8ba4ff; --accent-ink: #b0c1ff; --accent-soft: #1d2340; --accent-line: #3b4779; }
:root[data-theme="dark"][data-area="2"] { --accent: #4ecfb4; --accent-ink: #86e2d0; --accent-soft: #122b27; --accent-line: #2b5f55; }
:root[data-theme="dark"][data-area="3"] { --accent: #f0a866; --accent-ink: #f5c191; --accent-soft: #2f2016; --accent-line: #64432a; }
:root[data-theme="dark"][data-area="4"] { --accent: #bd97f5; --accent-ink: #d3b8fa; --accent-soft: #251a3a; --accent-line: #4c3a75; }

/* ---------- 3. 기본 ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.78;
  color: var(--ink);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { line-height: 1.38; margin: 0; font-weight: 750; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin: .3em 0; }
code, kbd, samp { font-family: var(--font-mono); font-size: .9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 4. 헤더 ---------- */
.tb-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.tb-header .bar {
  max-width: var(--maxw-wide); margin: 0 auto; padding: 0 20px;
  height: 54px; display: flex; align-items: center; gap: 10px;
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); min-width: 0; }
.crumb a { color: var(--ink-2); white-space: nowrap; }
.crumb a:hover { color: var(--accent-ink); }
.crumb .sep { color: var(--ink-4); }
.crumb .here { color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-header .spacer { flex: 1 1 auto; }
.hbtn {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: 32px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.hbtn:hover { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-soft); text-decoration: none; }
.hbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .hbtn[aria-pressed="true"],
:root:not([data-theme="light"]) .hbtn[aria-pressed="true"] { color: #10131a; }

/* ---------- 5. 히어로 ---------- */
.hero { padding: 40px 0 26px; background: linear-gradient(180deg, var(--accent-soft), transparent 88%); border-bottom: 1px solid var(--line); }
.hero .eyebrow { font-size: 13px; font-weight: 750; letter-spacing: .06em; color: var(--accent-ink); text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero h1 { font-size: clamp(26px, 4.6vw, 38px); }
.hero h1 .sub { display: block; font-size: clamp(15px, 2.3vw, 19px); font-weight: 600; color: var(--ink-3); margin-top: 8px; letter-spacing: -.01em; }
.hero .lead { margin: 16px 0 0; font-size: 16.5px; color: var(--ink-2); max-width: 62ch; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.std-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 7px; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: -.01em; }
:root[data-theme="dark"] .std-badge, :root:not([data-theme="light"]) .std-badge { color: #10131a; }
.goals { margin: 20px 0 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.goals .goals-label { font-size: 12.5px; font-weight: 750; color: var(--accent-ink); letter-spacing: .02em; margin-bottom: 8px; }
.goals ul { margin: 0; padding-left: 1.2em; }
.goals li { font-size: 15px; color: var(--ink-2); }

/* ---------- 6. 섹션 ---------- */
main { padding: 34px 0 60px; }
.section { margin: 0 0 42px; }
.sec-head { display: flex; align-items: baseline; gap: 11px; margin: 0 0 16px; padding-bottom: 11px; border-bottom: 2px solid var(--line); }
.sec-num { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 27px; height: 27px; padding: 0 7px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; }
:root[data-theme="dark"] .sec-num, :root:not([data-theme="light"]) .sec-num { color: #10131a; }
.sec-head h2 { font-size: clamp(19px, 3vw, 23px); }
.sec-head .sec-tag { margin-left: auto; font-size: 12px; font-weight: 650; color: var(--ink-4); white-space: nowrap; }
h3.sub-head { font-size: 17.5px; margin: 26px 0 10px; color: var(--ink); }
h4.mini-head { font-size: 15.5px; margin: 18px 0 7px; color: var(--ink); }

/* ---------- 7. 박스 ---------- */
.box { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin: 0 0 18px; position: relative; }
.box-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 750; letter-spacing: .02em; margin-bottom: 8px; }
.box-think { background: var(--accent-soft); border-color: var(--accent-line); }
.box-think .box-label { color: var(--accent-ink); }
.box-info { background: var(--surface-2); }
.box-info .box-label { color: var(--ink-3); }
.box-concept { background: var(--surface); border-left: 4px solid var(--accent); }
.box-concept .box-label { color: var(--accent-ink); }
.box-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.box-warn .box-label { color: var(--warn); }
.box-ok { background: var(--ok-soft); border-color: var(--ok-line); }
.box-ok .box-label { color: var(--ok); }
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }

/* 접히는 상자 */
details.more-box { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 18px; overflow: hidden; }
details.more-box > summary { padding: 13px 17px; cursor: pointer; font-size: 14.5px; font-weight: 700; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 9px; }
details.more-box > summary::-webkit-details-marker { display: none; }
details.more-box > summary::after { content: "＋"; margin-left: auto; color: var(--ink-4); font-weight: 700; }
details.more-box[open] > summary::after { content: "－"; }
details.more-box > summary:hover { background: var(--surface-2); }
details.more-box .more-body { padding: 3px 17px 17px; border-top: 1px solid var(--line); font-size: 15.5px; color: var(--ink-2); }
.plus-tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; font-weight: 750; }

/* 용어 강조 */
.term { font-weight: 700; color: var(--accent-ink); background: linear-gradient(transparent 62%, var(--accent-soft) 62%); padding: 0 1px; }
.hl { background: linear-gradient(transparent 60%, var(--warn-soft) 60%); font-weight: 650; }
.mono { font-family: var(--font-mono); font-size: .93em; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }

/* ---------- 8. 카드 그리드 ---------- */
.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 0 0 18px; }
.mini-card { padding: 15px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.mini-card .icon { font-size: 22px; line-height: 1; display: block; margin-bottom: 8px; }
.mini-card h4 { font-size: 15.5px; margin: 0 0 5px; }
.mini-card p { font-size: 14px; color: var(--ink-3); margin: 0; line-height: 1.65; }

/* ---------- 9. 표 ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tb { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 420px; }
table.tb th, table.tb td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tb thead th { background: var(--surface-2); font-weight: 750; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
table.tb tbody tr:last-child td { border-bottom: 0; }
table.tb tbody tr:hover { background: var(--surface-2); }
table.tb .good { color: var(--ok); font-weight: 650; }
table.tb .bad { color: var(--no); font-weight: 650; }
table.tb .num { text-align: right; font-family: var(--font-mono); font-size: 13.5px; }
table.tb caption { padding: 10px 13px; font-size: 13px; color: var(--ink-3); text-align: left; border-bottom: 1px solid var(--line); }

/* ---------- 10. 시뮬레이터 패널 ---------- */
.sim-panel { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); margin: 0 0 22px; overflow: hidden; }
.sim-head { display: flex; align-items: center; gap: 9px; padding: 12px 17px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.sim-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; box-shadow: 0 0 0 3px var(--accent-soft); }
.sim-title { font-size: 15px; font-weight: 750; }
.sim-tag { margin-left: auto; font-size: 11.5px; font-weight: 750; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.sim-body { padding: 17px; }
.sim-desc { font-size: 14.5px; color: var(--ink-3); margin: 0 0 14px; }
.sim-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 0; }
.sim-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sim-stats { display: flex; flex-wrap: wrap; gap: 9px; margin: 13px 0 0; }
.sim-stat { flex: 1 1 88px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.sim-stat .l { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 650; margin-bottom: 2px; }
.sim-stat .v { display: block; font-size: 19px; font-weight: 800; font-family: var(--font-mono); color: var(--accent-ink); letter-spacing: -.02em; }
.sim-log { margin: 13px 0 0; max-height: 168px; overflow-y: auto; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.8; color: var(--ink-2); }
.sim-log .t { color: var(--ink-4); margin-right: 7px; }
.sim-log .em { color: var(--accent-ink); font-weight: 700; }
.sim-canvas-wrap { display: flex; justify-content: center; padding: 6px 0; overflow-x: auto; }
canvas.sim { border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); display: block; touch-action: none; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0, 0, 0, .12); }

/* 컨트롤 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: 14px; font-weight: 650; color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--surface-2); border-color: var(--accent-line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary, :root:not([data-theme="light"]) .btn.primary { color: #10131a; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.ctl { display: inline-flex; flex-direction: column; gap: 4px; min-width: 156px; flex: 0 1 auto; }
.ctl > label { font-size: 12.5px; font-weight: 650; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }
.ctl > label b { color: var(--accent-ink); font-family: var(--font-mono); font-weight: 750; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 20px; }
select, input[type="text"], input[type="number"], textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; width: 100%;
}
textarea { line-height: 1.7; resize: vertical; min-height: 76px; }
select:focus, input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-3); border-radius: 10px; border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 650; color: var(--ink-2); padding: 6px 13px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.switch-row { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); }

/* ---------- 11. 빈칸 채우기 ---------- */
.blank { font-weight: 700; color: var(--accent-ink); background: linear-gradient(transparent 62%, var(--accent-soft) 62%); padding: 0 1px; }
body.blank-mode .blank { background: none; padding: 0; }
.blank-input {
  font: inherit; font-size: .97em; font-weight: 700; text-align: center;
  color: var(--accent-ink); background: var(--surface);
  border: 0; border-bottom: 2.5px dashed var(--accent-line);
  border-radius: 4px 4px 0 0; padding: 0 5px; margin: 0 1px;
  min-width: 3.4em; max-width: 100%;
}
.blank-input::placeholder { color: var(--ink-4); font-weight: 500; }
.blank-input:focus { outline: none; border-bottom-style: solid; border-bottom-color: var(--accent); background: var(--accent-soft); }
.blank-input.ok { color: var(--ok); border-bottom-color: var(--ok); border-bottom-style: solid; background: var(--ok-soft); }
.blank-input.no { color: var(--no); border-bottom-color: var(--no); border-bottom-style: solid; background: var(--no-soft); }
.blank-mark { font-size: .82em; font-weight: 800; margin-left: 2px; vertical-align: baseline; }
.blank-mark.ok { color: var(--ok); }
.blank-mark.no { color: var(--no); }
.blank-hintbtn { font: inherit; font-size: .72em; font-weight: 800; line-height: 1; border: 1px solid var(--accent-line); background: var(--surface); color: var(--accent-ink); border-radius: 50%; width: 1.5em; height: 1.5em; padding: 0; margin-left: 3px; cursor: pointer; vertical-align: super; }
.blank-hintbtn:hover { background: var(--accent-soft); }
.blank-hint { display: inline-block; font-size: .8em; font-weight: 600; color: var(--ink-3); background: var(--surface-3); border-radius: 5px; padding: 1px 7px; margin-left: 4px; }

.blank-bar {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 11px 15px; margin: 0 0 20px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius);
}
.blank-bar .bb-title { font-size: 14px; font-weight: 750; color: var(--accent-ink); }
.blank-bar .bb-score { font-family: var(--font-mono); font-size: 14px; font-weight: 800; color: var(--accent-ink); }
.blank-bar .spacer { flex: 1 1 auto; }

/* 낱말 채우기 활동 (단어 은행) */
.cloze { padding: 17px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin: 0 0 20px; }
.cloze-head { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 750; margin-bottom: 4px; }
.cloze-head .q-icon { font-size: 17px; }
.cloze-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 13px; }
.cloze-bank { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); margin-bottom: 15px; }
.cloze-bank .bank-label { font-size: 12px; font-weight: 700; color: var(--ink-3); width: 100%; margin-bottom: 2px; }
.word-pill { font: inherit; font-size: 13.5px; font-weight: 650; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.word-pill:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.word-pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .word-pill[aria-pressed="true"], :root:not([data-theme="light"]) .word-pill[aria-pressed="true"] { color: #10131a; }
.word-pill.used { opacity: .32; text-decoration: line-through; cursor: default; }
.cloze-sent { font-size: 15.5px; line-height: 2.2; margin: 0 0 9px; padding-left: 1.7em; text-indent: -1.7em; }
.cloze-sent .n { display: inline-block; width: 1.5em; font-weight: 800; color: var(--ink-4); font-size: 13.5px; text-indent: 0; }
.slot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 6.5em; min-height: 1.85em; padding: 0 9px; margin: 0 2px;
  border: 2px dashed var(--accent-line); border-radius: 8px; background: var(--surface-2);
  font-size: .95em; font-weight: 700; color: var(--accent-ink); cursor: pointer; vertical-align: middle;
}
.slot:hover { border-color: var(--accent); background: var(--accent-soft); }
.slot.filled { border-style: solid; background: var(--accent-soft); }
.slot.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); border-style: solid; }
.slot.no { border-color: var(--no); background: var(--no-soft); color: var(--no); border-style: solid; }
.slot.armed { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 12. 확인 문제 ---------- */
.quiz { padding: 19px; border-radius: var(--radius-lg); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); margin: 0 0 22px; }
.quiz-head { display: flex; align-items: center; gap: 9px; margin-bottom: 3px; }
.quiz-head .q-icon { font-size: 19px; }
.quiz-head h4 { font-size: 16.5px; }
.quiz-head .q-score { margin-left: auto; font-family: var(--font-mono); font-size: 14px; font-weight: 800; color: var(--accent-ink); }
.q-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 17px; }
.q-item { padding: 15px 0; border-top: 1px solid var(--line); }
.q-item:first-of-type { border-top: 0; padding-top: 4px; }
.q-text { font-size: 15.5px; font-weight: 650; margin: 0 0 11px; display: flex; gap: 9px; align-items: baseline; }
.q-text .qno { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; font-weight: 800; }
.q-text .qtype { flex: 0 0 auto; font-size: 11px; font-weight: 750; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); align-self: center; }
.q-body { padding-left: 31px; }
.q-choices { display: flex; flex-direction: column; gap: 7px; }
.q-choice {
  display: flex; align-items: flex-start; gap: 9px; text-align: left;
  font: inherit; font-size: 14.8px; padding: 10px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; width: 100%;
}
.q-choice:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); }
.q-choice .mk { flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; color: var(--ink-3); margin-top: 1px; }
.q-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.q-choice[aria-pressed="true"] .mk { background: var(--accent); border-color: var(--accent); color: #fff; }
.q-choice.ok { border-color: var(--ok); background: var(--ok-soft); }
.q-choice.ok .mk { background: var(--ok); border-color: var(--ok); color: #fff; }
.q-choice.no { border-color: var(--no); background: var(--no-soft); }
.q-choice.no .mk { background: var(--no); border-color: var(--no); color: #fff; }
.q-choice:disabled { cursor: default; }
.ox-row { display: flex; gap: 9px; }
.ox-row .q-choice { flex: 1 1 0; justify-content: center; font-size: 19px; font-weight: 800; padding: 12px; }
.q-short { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.q-short input { flex: 1 1 190px; max-width: 340px; }
.q-order { display: flex; flex-direction: column; gap: 7px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14.8px; }
.order-item .oh { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 800; }
.order-item .otxt { flex: 1 1 auto; }
.order-item .oc { display: flex; gap: 3px; flex: 0 0 auto; }
.order-item .oc button { width: 27px; height: 27px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.order-item .oc button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-ink); }
.order-item.ok { border-color: var(--ok); background: var(--ok-soft); }
.order-item.no { border-color: var(--no); background: var(--no-soft); }
.q-match { display: grid; gap: 8px; }
.match-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.match-row .ml { font-size: 14.8px; font-weight: 600; }
.match-row select { width: auto; min-width: 160px; font-size: 13.5px; }
.match-row.ok { border-color: var(--ok); background: var(--ok-soft); }
.match-row.no { border-color: var(--no); background: var(--no-soft); }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.q-feedback { margin-top: 11px; padding: 11px 14px; border-radius: 10px; font-size: 14.2px; line-height: 1.72; display: none; }
.q-feedback.show { display: block; }
.q-feedback.ok { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ink); }
.q-feedback.no { background: var(--no-soft); border: 1px solid var(--no-line); color: var(--ink); }
.q-feedback b { font-weight: 800; }
.q-foot { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.q-result { font-size: 14.5px; font-weight: 700; color: var(--accent-ink); }

/* ---------- 13. 활동 기록 (활동지) ---------- */
.note { padding: 17px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin: 0 0 20px; }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 750; margin-bottom: 5px; }
.note-head .n-icon { font-size: 17px; }
.note-head .n-state { margin-left: auto; font-size: 12px; font-weight: 650; color: var(--ink-4); }
.note-prompt { font-size: 14.5px; color: var(--ink-2); margin: 0 0 11px; }
.note-prompt ul { margin: 7px 0 0; }
.note-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.note-foot .hintxt { font-size: 12.5px; color: var(--ink-4); }
.field-row { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 11px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }

/* ---------- 14. 자가평가 ---------- */
.rubric { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin: 0 0 20px; }
.rubric-row { padding: 13px 16px; border-top: 1px solid var(--line); }
.rubric-row:first-child { border-top: 0; }
.rubric-row .rq { font-size: 14.8px; font-weight: 650; margin-bottom: 9px; display: flex; gap: 8px; align-items: baseline; }
.rubric-row .rq code { font-size: 11.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; flex: 0 0 auto; }
.lv-row { display: flex; gap: 6px; flex-wrap: wrap; }
.lv { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.lv:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.lv[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .lv[aria-pressed="true"], :root:not([data-theme="light"]) .lv[aria-pressed="true"] { color: #10131a; }
.lv small { font-weight: 600; opacity: .8; margin-left: 4px; }

/* ---------- 15. 홈 · 영역 목차 ---------- */
.area-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.area-card { display: block; padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .13s, box-shadow .13s, border-color .13s; position: relative; overflow: hidden; }
.area-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--ac-line); text-decoration: none; }
.area-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--ac); }
.area-card .ac-no { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ac); color: #fff; font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.area-card h3 { font-size: 19.5px; margin: 0 0 7px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.area-card .ac-tag { font-size: 13px; font-weight: 650; color: var(--ac-ink); margin: 0 0 9px; }
.area-card p { font-size: 14.2px; color: var(--ink-3); margin: 0 0 14px; line-height: 1.68; }
.area-card .ac-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 12px; color: var(--ink-4); font-weight: 650; }
.area-card .ac-std { font-family: var(--font-mono); font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.area-card .ac-bar { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 13px; }
.area-card .ac-bar i { display: block; height: 100%; background: var(--ac); border-radius: 999px; transition: width .4s; }
.area-card[data-ac="1"] { --ac: #3b5bdb; --ac-ink: #2942a8; --ac-line: #b8c4f7; }
.area-card[data-ac="2"] { --ac: #0d8f7a; --ac-ink: #096b5c; --ac-line: #9fdccf; }
.area-card[data-ac="3"] { --ac: #b3541e; --ac-ink: #8c4116; --ac-line: #f0c3a3; }
.area-card[data-ac="4"] { --ac: #7a44c9; --ac-ink: #5d33a0; --ac-line: #d3bcf3; }
:root[data-theme="dark"] .area-card[data-ac="1"], :root:not([data-theme="light"]) .area-card[data-ac="1"] { --ac: #8ba4ff; --ac-ink: #b0c1ff; --ac-line: #3b4779; }
:root[data-theme="dark"] .area-card[data-ac="2"], :root:not([data-theme="light"]) .area-card[data-ac="2"] { --ac: #4ecfb4; --ac-ink: #86e2d0; --ac-line: #2b5f55; }
:root[data-theme="dark"] .area-card[data-ac="3"], :root:not([data-theme="light"]) .area-card[data-ac="3"] { --ac: #f0a866; --ac-ink: #f5c191; --ac-line: #64432a; }
:root[data-theme="dark"] .area-card[data-ac="4"], :root:not([data-theme="light"]) .area-card[data-ac="4"] { --ac: #bd97f5; --ac-ink: #d3b8fa; --ac-line: #4c3a75; }
:root[data-theme="dark"] .area-card .ac-no, :root:not([data-theme="light"]) .area-card .ac-no { color: #10131a; }

.lesson-list { display: flex; flex-direction: column; gap: 11px; }
.lesson-card { display: flex; align-items: center; gap: 15px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s; }
.lesson-card:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: var(--accent-line); text-decoration: none; }
.lesson-card .lc-no { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; }
.lesson-card .lc-no b { font-size: 17px; line-height: 1; }
.lesson-card .lc-no small { font-size: 10px; font-weight: 700; }
.lesson-card.done .lc-no { background: var(--ok-soft); color: var(--ok); }
.lesson-card .lc-body { flex: 1 1 auto; min-width: 0; }
.lesson-card .lc-title { font-size: 16px; font-weight: 750; color: var(--ink); margin: 0 0 3px; }
.lesson-card .lc-sub { font-size: 13.8px; color: var(--ink-3); margin: 0 0 7px; }
.lesson-card .lc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11.5px; }
.lesson-card .lc-std { font-family: var(--font-mono); font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); }
.lesson-card .lc-sim { color: var(--ink-4); font-weight: 600; }
.lesson-card .lc-go { flex: 0 0 auto; color: var(--ink-4); font-size: 20px; }
.lesson-card.closing .lc-no { background: var(--surface-3); color: var(--ink-2); font-size: 19px; }

.stat-strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 0 0 26px; }
.stat-box { padding: 15px 17px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.stat-box .sl { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 650; margin-bottom: 4px; }
.stat-box .sv { display: block; font-size: 25px; font-weight: 800; color: var(--accent-ink); font-family: var(--font-mono); letter-spacing: -.03em; }
.stat-box .sv small { font-size: 14px; color: var(--ink-4); font-weight: 700; }

/* ---------- 16. 하단 이동 ---------- */
.nav-foot { display: flex; gap: 12px; margin: 44px 0 0; }
.nav-foot a { flex: 1 1 0; display: flex; flex-direction: column; gap: 3px; padding: 15px 17px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.nav-foot a:hover { border-color: var(--accent-line); background: var(--accent-soft); text-decoration: none; }
.nav-foot .dir { font-size: 12px; font-weight: 750; color: var(--ink-4); }
.nav-foot .where { font-size: 15px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-foot a.next { text-align: right; }
.tb-footer { border-top: 1px solid var(--line); padding: 26px 0 40px; font-size: 13px; color: var(--ink-4); background: var(--bg-soft); }
.tb-footer .fwrap { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 20px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.tb-footer .spacer { flex: 1 1 auto; }
.tb-footer a { color: var(--ink-3); }
/* 저작권 · 이용 조건 */
.tb-footer .flic { max-width: var(--maxw-wide); margin: 14px auto 0; padding: 13px 20px 0; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.9; color: var(--ink-4); }
.tb-footer .flic b { color: var(--ink-2); font-weight: 750; }
.tb-footer .flic a { color: var(--ink-3); text-decoration: underline; }

/* ---------- 17. 학습 도구 독 ---------- */
.dock { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.dock-panel { display: none; width: 262px; padding: 15px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); }
.dock-panel.open { display: block; }
.dock-panel h5 { font-size: 13.5px; margin: 0 0 10px; color: var(--ink); }
.dock-panel .drow { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 13.5px; color: var(--ink-2); }
.dock-panel .drow:last-child { margin-bottom: 0; }
.dock-panel .btn { width: 100%; }
.dock-prog { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 3px 0 12px; }
.dock-prog i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.dock-fab { width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-lg); font-size: 21px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.dock-fab:hover { background: var(--accent-soft); border-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px); z-index: 90; padding: 11px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 650; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .22s, transform .22s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 18. 반응형 ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero { padding: 30px 0 22px; }
  .nav-foot { flex-direction: column; }
  .q-body { padding-left: 0; }
  .sim-body { padding: 14px; }
  .crumb .mid { display: none; }
  .dock-panel { width: min(262px, calc(100vw - 42px)); }
  .cloze-sent { padding-left: 0; text-indent: 0; }
}

/* ---------- 19. 인쇄 ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #f2f2f2; --line: #bbb; --ink: #000; --ink-2: #222; --ink-3: #444; }
  .tb-header, .dock, .nav-foot, .blank-bar, .q-actions, .q-foot, .sim-controls, .note-foot { display: none !important; }
  /* 인쇄물에도 저작권 표시는 남긴다 (이동 링크만 감춤) */
  .tb-footer { display: block !important; background: none; border-top: 0; padding: 8px 0 0; }
  .tb-footer .fwrap { display: none !important; }
  .tb-footer .flic { margin-top: 0; padding: 8px 0 0; border-top: 1px solid #bbb; font-size: 8.5pt; line-height: 1.6; color: #444; }
  .tb-footer .flic b { color: #000; }
  body { background: #fff; font-size: 11pt; }
  .hero { padding: 0 0 14px; background: none; }
  .section { break-inside: avoid; margin-bottom: 20px; }
  .sim-panel, .quiz, .box, .note, .cloze { box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  details.more-box { break-inside: avoid; }
  details.more-box > summary::after { content: ""; }
}

/* ---------- 20. 모션 감소 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
