@import url('https://fonts.googleapis.com/css2?family=Jua&family=Gothic+A1:wght@400;500;600;700;800;900&display=swap');

/* =========================================================================
   science-teacher-hub 공용 테마 — 정본 (v2)
   저장소 12곳의 theme.css 5개 버전을 하나로 합침. 기준: earth-science-2 계열.
   색은 전부 토큰으로만 정의하고, 다크 모드는 토큰만 다시 선언한다.
   캔버스 그림도 cssVar()로 같은 토큰을 읽으므로 테마를 따라간다.
   ========================================================================= */

/* ---------- 라이트 (기본) ---------- */
:root {
--bg: #eef6fb;
--card: #ffffff;
--card-2: #f4f9fb;
--rail: #ffffff;
--ink: #12203a;
--mist: #5c7086;
--line: #dfeaf1;
--brand: #3db7e8;
--brand-dim: #1f96c9;
--brand-100: #d9f0fb;
--brand-700: #1179a6;
--teal: #14b8a6;
--teal-100: #ccfbf1;
--teal-700: #0f766e;
--coral: #ff9752;
--coral-100: #ffe8d3;
--coral-700: #c2590f;
--violet: #8b6bf0;
--violet-100: #ece5fd;
--violet-700: #6234c9;
--amber: #ffb800;
--amber-100: #fff2cc;
--amber-700: #a86a00;
--rose: #ff6b93;
--rose-100: #ffe0e9;
--rose-700: #c23864;
--green: #4cb963;
--green-100: #dcf5e1;
--green-700: #1f7a37;
/* 강조색 위에 얹는 글자색 / 유리 배경 / 슬라이더 손잡이 테두리 */
--on-accent: #ffffff;
--glass: rgba(255, 255, 255, .88);
--thumb-ring: #ffffff;
--shadow-card: 0 10px 24px -8px rgba(18, 32, 58, .12), 0 2px 6px rgba(18, 32, 58, .06);
--shadow-pop: 0 16px 34px -10px rgba(18, 32, 58, .2);
--shadow-brand: 0 6px 14px -4px rgba(61, 183, 232, .55);
/* 예전 단원 페이지가 아직 쓰는 이름들 (캔버스 cssVar 포함) */
--abyss: var(--bg);
--panel: var(--card);
--panel-2: var(--card-2);
--foam: var(--ink);
--teal-dim: var(--teal-700);
--cold: var(--brand);
--good: var(--green);
--warn: var(--coral);
}

/* ---------- 다크 : OS 설정 (명시적으로 라이트를 고른 경우는 제외) ---------- */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #0a1620;
--card: #10222f;
--card-2: #162b3a;
--rail: #0c1c28;
--ink: #e6f0f5;
--mist: #93aebd;
--line: #23404f;
--brand: #4fc3ec;
--brand-dim: #7fd4f2;
--brand-100: #10323f;
--brand-700: #8ad9f5;
--teal: #2ed3bd;
--teal-100: #0e332f;
--teal-700: #74e2d1;
--coral: #ff9d63;
--coral-100: #3a2415;
--coral-700: #ffbb91;
--violet: #a288f5;
--violet-100: #241d3d;
--violet-700: #c5b4fb;
--amber: #ffc42e;
--amber-100: #3a2f0e;
--amber-700: #ffda7c;
--rose: #ff86a6;
--rose-100: #3a1c26;
--rose-700: #ffafc4;
--green: #63c97a;
--green-100: #16301d;
--green-700: #99e0a8;
--on-accent: #06202c;
--glass: rgba(16, 34, 47, .85);
--thumb-ring: #10222f;
--shadow-card: 0 10px 24px -8px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35);
--shadow-pop: 0 16px 34px -10px rgba(0, 0, 0, .7);
--shadow-brand: 0 6px 14px -4px rgba(79, 195, 236, .35);
}
}

/* ---------- 다크 : 사용자가 버튼으로 고른 경우 ---------- */
:root[data-theme="dark"] {
--bg: #0a1620;
--card: #10222f;
--card-2: #162b3a;
--rail: #0c1c28;
--ink: #e6f0f5;
--mist: #93aebd;
--line: #23404f;
--brand: #4fc3ec;
--brand-dim: #7fd4f2;
--brand-100: #10323f;
--brand-700: #8ad9f5;
--teal: #2ed3bd;
--teal-100: #0e332f;
--teal-700: #74e2d1;
--coral: #ff9d63;
--coral-100: #3a2415;
--coral-700: #ffbb91;
--violet: #a288f5;
--violet-100: #241d3d;
--violet-700: #c5b4fb;
--amber: #ffc42e;
--amber-100: #3a2f0e;
--amber-700: #ffda7c;
--rose: #ff86a6;
--rose-100: #3a1c26;
--rose-700: #ffafc4;
--green: #63c97a;
--green-100: #16301d;
--green-700: #99e0a8;
--on-accent: #06202c;
--glass: rgba(16, 34, 47, .85);
--thumb-ring: #10222f;
--shadow-card: 0 10px 24px -8px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35);
--shadow-pop: 0 16px 34px -10px rgba(0, 0, 0, .7);
--shadow-brand: 0 6px 14px -4px rgba(79, 195, 236, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
margin: 0;
background: var(--bg);
color: var(--ink);
font-family: "Gothic A1", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
min-height: 100vh;
overflow-x: hidden;
word-break: keep-all;
-webkit-font-smoothing: antialiased;
}
.display { font-family: "Jua", "Gothic A1", sans-serif; font-weight: 400; letter-spacing: -.01em; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-variant-numeric: tabular-nums; }
a { color: inherit; }

/* ===================== App shell (unit pages) ===================== */
.app { display: grid; grid-template-columns: minmax(200px, 250px) 1fr; min-height: 100vh; }
.app > * { min-width: 0; }   /* 그리드 칸이 내용 때문에 화면보다 넓어지는 것을 막는다 */
.rail {
background: var(--rail);
border-right: 3px solid var(--line);
display: flex; flex-direction: column;
padding: 22px 12px; gap: 6px;
height: 100vh; position: sticky; top: 0;
}
.brand { padding: 4px 10px 18px; border-bottom: 3px dashed var(--line); margin-bottom: 12px; }
.brand a.home { color: var(--brand-700); font-size: 12px; text-decoration: none; font-weight: 700; }
.brand a.home:hover { text-decoration: underline; }
.brand .eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal-700); font-weight: 800; margin-top: 10px; }
.brand h1 { font-size: 21px; margin: 6px 0 0; line-height: 1.3; font-weight: 400; }
.tab-btn {
display: flex; align-items: center; gap: 10px;
background: transparent; border: 2px solid transparent; color: var(--mist);
text-align: left; padding: 11px 12px; border-radius: 14px; cursor: pointer;
font-size: 13.5px; font-weight: 700; font-family: inherit; transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.tab-btn .num { font-family: "Jua"; font-size: 12px; color: var(--mist); opacity: .55; width: 18px; }
@media (hover: hover) {
.tab-btn:hover { background: var(--card-2); color: var(--ink); transform: translateX(1px); }
}
.tab-btn.active { background: var(--brand); border-color: var(--brand); color: var(--on-accent); box-shadow: var(--shadow-brand); }
.tab-btn.active .num { color: var(--on-accent); opacity: 1; }
.tab-strip { display: flex; flex-direction: column; gap: 6px; }
.tab-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cv-big-tip { display: none; }

/* --- 780px 이하: 사이드바를 가로 탭바로. 라벨이 한 글자씩 쪼개지지 않게 고정 --- */
@media (max-width: 780px) {
.app { grid-template-columns: 1fr; }
.rail {
flex-direction: row !important; align-items: center;
overflow-x: auto; -webkit-overflow-scrolling: touch;
height: auto !important; position: static !important;
border-right: none !important; border-bottom: 3px solid var(--line);
padding: 12px; gap: 8px;
}
.rail .brand {
flex: 0 0 auto; margin: 0 6px 0 0; padding: 0 14px 0 4px;
border-bottom: none; border-right: 3px dashed var(--line);
}
.rail .brand .eyebrow { margin-top: 4px; }
.rail .brand h1 { font-size: 15px; margin: 2px 0 0; line-height: 1.25; }
.rail .tab-btn { flex: 0 0 auto; white-space: nowrap; }
/* 테마 버튼이 가로 탭바를 가리지 않도록 아래로 내린다 */
.theme-toggle { top: auto; bottom: 14px; right: 14px; }
main { padding: 22px 16px 60px; }
.controls { padding: 16px 16px 18px; }
.info-card, .detail-panel { margin-left: 16px; margin-right: 16px; }
.stat-row, .legend-row, .card-grid, .era-grid, .compare-wrap, .mini-grid { padding-left: 16px; padding-right: 16px; }
.foot-note { padding-left: 16px; padding-right: 16px; }
}

/* 휴대폰: 단원 이름 줄은 그대로 두고, 그 아래 탭 줄만 가로로 민다(theme.js 가 탭을 .tab-strip 으로 묶는다) */
@media (max-width: 780px) {
.rail { flex-direction: column !important; align-items: stretch; overflow-x: visible; padding: 10px 12px 8px; gap: 8px; }
.rail .brand { margin: 0; padding: 0 4px 8px; border-right: none; border-bottom: 3px dashed var(--line); }
.tab-strip { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 8px; padding: 2px 2px 6px; scrollbar-width: thin; }
.cv-big-row { justify-content: space-between; align-items: center; gap: 8px; }
.cv-big-tip { display: inline; font-size: 12.5px; color: var(--mist); line-height: 1.35; }
.cv-big-btn { border-color: var(--brand); background: var(--brand-100); color: var(--brand-700); padding: 8px 14px; font-size: 14px; flex: none; }
}
main { padding: 30px 34px 70px; max-width: 1000px; }
@media (max-width: 780px) { main { padding: 22px 16px 60px; } }   /* 바로 위 줄이 앞쪽 휴대폰 설정을 덮어쓰므로 여기서 다시 */
.stage-head { margin-bottom: 18px; }
.stage-head .eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-700); font-weight: 800; }
.stage-head h2 { font-size: 28px; margin: 6px 0 10px; text-wrap: balance; font-weight: 400; }
.stage-head p { color: var(--mist); font-size: 14.5px; line-height: 1.7; max-width: 660px; margin: 0; }

.stage-card { background: var(--card); border: 3px solid var(--line); border-radius: 26px; overflow: hidden; margin-top: 18px; box-shadow: var(--shadow-card); }
.canvas-wrap { position: relative; background: var(--card-2); border-bottom: 3px solid var(--line); }
canvas { display: block; width: 100%; max-width: 100%; height: auto; touch-action: pan-y pinch-zoom; }
.badge-row { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--glass); color: var(--ink); border: 2px solid var(--line); backdrop-filter: blur(3px); }

.controls { padding: 18px 22px 22px; display: flex; flex-wrap: wrap; gap: 22px; }
.ctrl-group { display: flex; flex-direction: column; gap: 9px; min-width: 170px; flex: 1; }
.ctrl-label { font-size: 11.5px; letter-spacing: .04em; color: var(--mist); font-weight: 800; display: flex; justify-content: space-between; }
.ctrl-label .val { color: var(--brand-700); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; background: var(--line); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); border: 3px solid var(--thumb-ring); box-shadow: 0 2px 8px rgba(31,150,201,.5); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); border: 3px solid var(--thumb-ring); cursor: pointer; }

.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 2px solid var(--line); background: var(--card-2); color: var(--mist); padding: 8px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 800; cursor: pointer; transition: all .15s; font-family: inherit; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-accent); }
.chip.warm.on { background: var(--coral); border-color: var(--coral); color: #331700; }
.chip.cold.on { background: var(--cold); border-color: var(--cold); color: var(--on-accent); }
.chip.violet.on { background: var(--violet); border-color: var(--violet); color: #1c1033; }
.chip:focus-visible, .tab-btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.seg { display: flex; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; width: fit-content; flex-wrap: wrap; background: var(--card-2); }
.seg button { border: none; background: transparent; color: var(--mist); padding: 8px 15px; font-size: 12.5px; font-weight: 800; font-family: inherit; cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--on-accent); }

.btn { border: 2px solid var(--line); background: var(--card-2); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 800; font-family: inherit; cursor: pointer; transition: all .15s; }
.btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-accent); box-shadow: var(--shadow-brand); }
.btn.primary:hover { background: var(--brand-dim); border-color: var(--brand-dim); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.readout { display: flex; align-items: center; gap: 10px; background: var(--card-2); border: 2px solid var(--line); border-radius: 14px; padding: 11px 15px; }
.readout .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.readout .txt { font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.readout .txt b { color: var(--brand-700); }

.info-card { margin: 0 22px 22px; padding: 15px 18px; border-radius: 16px; background: var(--brand-100); border: 2px solid var(--brand-100); font-size: 13.5px; line-height: 1.75; color: var(--ink); min-height: 22px; }
.info-card b { color: var(--brand-700); }
.info-card .tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; margin-right: 8px; }

.foot-note { color: var(--mist); font-size: 11.5px; padding: 0 22px 20px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; padding: 4px 22px 0; }
.pick-card { background: var(--card-2); border: 2px solid var(--line); border-radius: 18px; padding: 15px; cursor: pointer; text-align: left; transition: all .15s; color: var(--ink); font-family: inherit; }
.pick-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.pick-card.on { border-color: var(--brand); background: var(--brand-100); box-shadow: var(--shadow-card); }
.pick-card .ico { font-size: 24px; margin-bottom: 6px; display: block; }
.pick-card .t { font-size: 13.5px; font-weight: 800; margin-bottom: 3px; }
.pick-card .d { font-size: 11.5px; color: var(--mist); line-height: 1.5; }
.pick-card .pc-ico { font-size: 23px; margin-bottom: 6px; display: block; }
.pick-card .pc-name { font-weight: 800; font-size: 13.5px; margin-bottom: 3px; }
.pick-card .pc-sub { font-size: 11.5px; color: var(--mist); }

.detail-panel { margin: 16px 22px 22px; padding: 17px 19px; border-radius: 18px; background: var(--card-2); border: 2px solid var(--line); font-size: 13.5px; line-height: 1.8; color: var(--mist); }
.detail-panel h4 { margin: 0 0 8px; color: var(--ink); font-size: 15.5px; font-family: "Jua"; font-weight: 400; }
.detail-panel b { color: var(--ink); }
.detail-panel .hint { color: var(--mist); font-size: 12.5px; font-style: italic; }

.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 22px 26px; }
.mini-card { background: var(--card-2); border: 2px solid var(--line); border-radius: 16px; padding: 13px 15px; }
.mini-card .mi-ico { font-size: 21px; margin-bottom: 6px; }
.mini-card h4 { margin: 0 0 4px; font-size: 13.5px; color: var(--ink); font-weight: 800; }
.mini-card p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--mist); }

.timeline-wrap { padding: 12px 22px 4px; }
.timeline-track { position: relative; height: 10px; border-radius: 999px; background: var(--line); margin: 30px 4px 14px; }
.timeline-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-dim), var(--brand)); }
.timeline-ticks { display: flex; justify-content: space-between; padding: 0 2px; }
.timeline-ticks span { font-size: 10.5px; color: var(--mist); font-weight: 700; }
.timeline-dot { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--card); border: 4px solid var(--line); transform: translate(-50%, -50%); cursor: pointer; transition: border-color .15s, background .15s; }
.timeline-dot.on { border-color: var(--teal); background: var(--teal); }
.timeline-dot .td-label { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--mist); white-space: nowrap; font-weight: 700; }
.timeline-dot.on .td-label { color: var(--teal-700); font-weight: 800; }

.era-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; padding: 0 22px 18px; }
.era-btn { background: var(--card-2); border: 2px solid var(--line); color: var(--mist); padding: 11px 8px; border-radius: 14px; font-size: 12.5px; font-weight: 800; cursor: pointer; text-align: center; font-family: inherit; }
.era-btn.on { background: var(--teal); border-color: var(--teal); color: var(--on-accent); }

.compare-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 22px 22px; }
@media (max-width: 700px) { .compare-wrap { grid-template-columns: 1fr; } }
.compare-col { background: var(--card-2); border: 2px solid var(--line); border-radius: 16px; padding: 15px 17px; }
.compare-col h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--teal-700); font-weight: 800; }
.compare-col p { margin: 0; font-size: 12.5px; line-height: 1.75; color: var(--mist); }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 22px 18px; }
.stat-box { flex: 1; min-width: 120px; background: var(--card-2); border: 2px solid var(--line); border-radius: 16px; padding: 13px 15px; }
.stat-box .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mist); font-weight: 800; }
.stat-box .num { font-size: 21px; color: var(--brand-700); font-weight: 800; margin-top: 3px; font-family: "Jua"; }

.legend-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 2px 22px 16px; font-size: 12px; color: var(--mist); font-weight: 700; }
.legend-row .sw { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }

.theme-toggle {
position: fixed; top: 16px; right: 18px; z-index: 20;
background: var(--card); border: 2px solid var(--line); color: var(--mist);
border-radius: 999px; padding: 7px 14px; font-size: 11.5px; font-weight: 700;
font-family: inherit; cursor: pointer; box-shadow: var(--shadow-card);
}
.theme-toggle:hover { border-color: var(--brand); color: var(--ink); }
/* 위의 기본 규칙이 모바일 규칙(top:auto)보다 뒤에 있어 top·bottom 이 함께 걸려 버튼이 세로로 늘어났다 */
@media (max-width: 780px) { .theme-toggle { top: auto; bottom: 14px; right: 14px; } }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ===================== Home / hub cards ===================== */
.hero { padding: 54px 30px 30px; max-width: 1080px; margin: 0 auto; }
.hero .kicker { display: inline-flex; align-items: center; gap: 8px; background: var(--teal-100); color: var(--teal-700); font-weight: 800; font-size: 12px; padding: 7px 14px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(32px, 5vw, 48px); margin: 6px 0 16px; text-wrap: balance; font-weight: 400; }
.hero p { color: var(--mist); font-size: 15.5px; line-height: 1.8; max-width: 640px; margin: 0; }

.part-heading { max-width: 1080px; margin: 34px auto 0; padding: 0 30px; font-family: "Jua"; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.part-heading .roman { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; font-size: 14px; background: var(--brand-100); color: var(--brand-700); }

.grid { max-width: 1080px; margin: 14px auto 20px; padding: 0 30px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 20px; }
.unit-card { display: block; background: var(--card); border: 3px solid var(--line); border-radius: 28px; padding: 26px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; position: relative; overflow: hidden; box-shadow: var(--shadow-card); }
.unit-card:hover { border-color: var(--brand); transform: translateY(-4px); box-shadow: var(--shadow-pop); }
.unit-card .chapter { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 12px; font-family: "Jua"; font-size: 16px; margin-bottom: 12px; }
.unit-card h3 { font-size: 20px; margin: 0 0 9px; font-weight: 400; line-height: 1.35; }
.unit-card p { color: var(--mist); font-size: 13px; line-height: 1.65; margin: 0 0 14px; min-height: 40px; }
.unit-card .topics { display: flex; flex-wrap: wrap; gap: 6px; }
.unit-card .topics span { font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--card-2); border: 2px solid var(--line); color: var(--mist); }
.unit-card .go { position: absolute; top: 26px; right: 26px; color: var(--brand); font-size: 20px; font-weight: 900; }
.unit-card .count { position: absolute; bottom: 24px; right: 24px; font-size: 11px; color: var(--teal-700); font-weight: 800; background: var(--teal-100); padding: 4px 10px; border-radius: 999px; }
.unit-card.c1 .chapter { background: var(--brand-100); color: var(--brand-700); }
.unit-card.c2 .chapter { background: var(--coral-100); color: var(--coral-700); }
.unit-card.c3 .chapter { background: var(--violet-100); color: var(--violet-700); }

.part-label { max-width: 1080px; margin: 10px auto 0; padding: 30px 30px 0; font-size: 13px; letter-spacing: .04em; color: var(--ink); font-weight: 800; font-family: "Jua"; }
.tips { max-width: 1080px; margin: 16px auto 70px; padding: 0 30px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.tip-card { background: var(--card); border: 3px solid var(--line); border-radius: 20px; padding: 18px 20px; box-shadow: var(--shadow-card); }
.tip-card .num { font-family: "Jua"; font-size: 22px; color: var(--brand); }
.tip-card h4 { font-size: 14px; margin: 6px 0 5px; font-weight: 800; }
.tip-card p { font-size: 12.5px; color: var(--mist); line-height: 1.65; margin: 0; }
.back-link { max-width: 1080px; margin: 20px auto 0; padding: 0 30px; }
.back-link a { color: var(--mist); font-size: 12px; text-decoration: none; font-weight: 700; }
.back-link a:hover { color: var(--brand-700); }

/* ===================== 학습 설계 부품 (모든 단원 공용) =====================
   단원 페이지는 아래 클래스를 쓰고, theme.js 의 sthGate / sthWork 를 부르면 된다. */

/* 성취기준·학습목표·핵심용어 */
.std-chip { display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; font-weight: 700;
  background: var(--brand-100); color: var(--brand-700); padding: 3px 9px; border-radius: 999px; margin: 0 4px 8px 0; }
.std-note { font-size: 12.5px; color: var(--mist); line-height: 1.7; margin: 2px 0 0; }
.goal { margin: 6px 0 0; padding-left: 16px; color: var(--mist); font-size: 13.5px; line-height: 1.7; }
.goal li { margin: 2px 0; }
.terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.terms b { font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  background: var(--card-2); border: 2px solid var(--line); color: var(--mist); }

/* 예측 잠금 */
.gate { margin: 0 22px 22px; padding: 18px 20px; border-radius: 18px;
  background: var(--amber-100); border: 2px solid var(--amber); }
.gate h4 { margin: 0 0 4px; font-size: 15.5px; font-family: "Jua"; font-weight: 400; color: var(--ink); }
.gate p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.gate .opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 8px; }
.gate .opt { text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 11px 14px; font-size: 13px; font-weight: 700; font-family: inherit; color: var(--ink); cursor: pointer; }
.gate .opt:hover { border-color: var(--amber); }
.gate .opt.picked { background: var(--amber); border-color: var(--amber); color: #3a2a00; }
.gate.done { background: var(--card-2); border-color: var(--line); }
.veil { position: absolute; inset: 0; background: var(--card-2); display: flex; align-items: center;
  justify-content: center; text-align: center; padding: 24px; z-index: 2; }
.veil p { margin: 0; color: var(--mist); font-size: 13.5px; line-height: 1.8; max-width: 340px; }
.veil[hidden] { display: none; }

/* 오개념 상자 */
.miscon { margin: 0 22px 22px; padding: 16px 19px; border-radius: 16px; background: var(--rose-100);
  border: 2px solid var(--rose); font-size: 13.5px; line-height: 1.75; color: var(--ink); }
.miscon .tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
  background: var(--rose); color: #fff; padding: 2px 9px; border-radius: 999px; margin-bottom: 7px; }
.miscon cite { display: block; margin-top: 8px; font-style: normal; font-size: 11.5px; color: var(--mist); }
.miscon .sep { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rose); }
/* 카드 밖에 둘 때 */
.miscon.loose, .gate.loose { margin-left: 0; margin-right: 0; margin-top: 18px; }

/* 산출물 */
.work { margin: 0 22px 22px; }
.work label { display: block; font-size: 13px; font-weight: 800; color: var(--mist); margin: 16px 0 6px; }
.work textarea { width: 100%; min-height: 78px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card-2); color: var(--ink); font-family: inherit; font-size: 13.5px; line-height: 1.7; resize: vertical; }
.work textarea:focus { outline: 3px solid var(--brand); outline-offset: 2px; border-color: var(--brand); }
.work .hint { font-size: 12px; color: var(--mist); margin: 5px 0 0; line-height: 1.6; }
.saved { font-size: 12px; color: var(--teal-700); font-weight: 700; margin-left: 8px; }
.recap { margin: 0 22px 18px; padding: 15px 18px; border-radius: 16px; background: var(--card-2);
  border: 2px solid var(--line); font-size: 13.5px; line-height: 1.8; color: var(--ink); }
.recap b { color: var(--brand-700); }
.recap .none { color: var(--mist); font-weight: 400; }

/* 관측 자료 표 */
.tbl-wrap { overflow-x: auto; margin: 0 22px 22px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); }
table.obs { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; }
table.obs th, table.obs td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
table.obs thead th { background: var(--card-2); font-size: 11px; font-weight: 800; color: var(--mist);
  letter-spacing: .03em; border-bottom: 2px solid var(--line); }
table.obs tbody tr:last-child td { border-bottom: none; }
table.obs td.l { text-align: left; }
table.obs .num { font-family: ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
table.obs tr.mine { background: var(--brand-100); }
.ox { font-weight: 800; }
.ox.o { color: var(--green-700); } .ox.x { color: var(--mist); } .ox.t { color: var(--amber-700); }

@media (max-width: 780px) {
  .gate, .miscon, .work, .recap, .tbl-wrap { margin-left: 16px; margin-right: 16px; }
}

/* ---------- 한글 조판 ----------
   어절 단위로 줄을 바꾸고(keep-all), 아주 긴 영문·주소만 필요할 때 끊는다(break-word).
   괄호·가운뎃점이 든 짧은 어절은 theme.js 가 .nw 로 묶어 한 줄에 둔다.
   문단 끝줄에 낱말 하나만 남지 않게(text-wrap: pretty), 제목은 줄 길이를 고르게(balance).
   본문 자간은 한글 책처럼 아주 조금 좁힌다. */
body { overflow-wrap: break-word; line-break: strict; letter-spacing: -0.01em; }
.nw { white-space: nowrap; }
p, li, dd, blockquote, td, th, .say, .info-card, .detail-panel, .why, .hint, .q, .msg, .lab-task-t, .lab-hint,
.pc-ans, .pc-s, .pc-head p, .std-note, .miscon, .gate p, .veil p, .readout .txt, .mini-card p, .compare-col p, .tip-card p, .unit-card p { text-wrap: pretty; }
h1, h2, h3, h4, .display { text-wrap: balance; }

/* ---------- 학생 화면은 이 단원만 ----------
   ‘← 과목’ 링크와 교사용 안내는 기본으로 숨기고, 교사 기기(<html class="sth-teacher">)에서만 보인다.
   과목 첫 화면(단원 목록)은 학생에게 안내 카드만 보인다(theme.js). */
html:not(.sth-teacher) .rail .brand a.home, html:not(.sth-teacher) .teacher-note { display: none !important; }
html:not(.sth-teacher) a.unit-card { visibility: hidden; }
.gate-note { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate-card { max-width: 520px; background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 28px 26px; box-shadow: var(--shadow-card); }
.gate-card h1 { font-size: clamp(24px, 6vw, 32px); font-weight: 400; margin: 8px 0 12px; }
.gate-card p { color: var(--mist); font-size: 15px; line-height: 1.8; margin: 0; }
.gate-card .eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--teal-700); font-weight: 800; }

/* ---------- 학생 입장 QR (교사 기기에서만 버튼이 생긴다) ---------- */
.qr-btn { display: inline-block; margin-top: 10px; border: 2px solid var(--brand); background: var(--brand-100); color: var(--brand-700);
  padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.qr-btn:hover { background: var(--brand); color: #fff; }
.unit-card .qr-btn { margin-top: 4px; }
.qr-full { position: fixed; inset: 0; z-index: 9999; background: rgba(10, 20, 30, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.qf-box { background: #fff; color: #10202e; border-radius: 26px; padding: 26px 28px 22px; text-align: center; max-width: min(96vw, 720px); max-height: 96vh; overflow: auto; }
.qf-sub { font-size: 14px; font-weight: 800; color: #0f766e; letter-spacing: .02em; }
.qf-title { font-family: "Jua", "Gothic A1", sans-serif; font-size: clamp(24px, 4.5vw, 40px); margin: 6px 0 14px; line-height: 1.25; }
.qf-code { width: min(64vh, 80vw); height: min(64vh, 80vw); margin: 0 auto; }
.qf-code svg { width: 100%; height: 100%; display: block; }
.qf-url { font-family: ui-monospace, Menlo, monospace; font-size: clamp(13px, 2vw, 18px); margin: 12px 0 4px; word-break: break-all; color: #10202e; }
.qf-hint { font-size: 13.5px; color: #5b6b7b; margin: 4px 0 14px; }
@media print { .qr-btn, .cv-big-row, .hero-zoom { display: none !important; } }
/* 과목 전체 QR(?all=1) — 과목 첫 화면 머리(교사 기기)와, 그 QR 로 들어온 학생 화면 */
.subj-qr { display: flex; gap: 16px; align-items: center; margin-top: 22px; background: var(--card, #fff); border: 2px solid var(--brand); border-radius: 18px; padding: 14px 16px; max-width: 660px; }
.subj-qr .sq-code { flex: 0 0 132px; width: 132px; height: 132px; background: #fff; border-radius: 10px; padding: 6px; box-sizing: border-box; }
.subj-qr .sq-code svg { width: 100%; height: 100%; display: block; }
.subj-qr b { display: block; font-size: 16px; color: var(--ink); }
.subj-qr .sq-txt > span { display: block; font-size: 13px; color: var(--mist); line-height: 1.6; margin: 4px 0 8px; }
.subj-qr .sq-row { display: flex; flex-wrap: wrap; gap: 6px; }
.subj-qr .sq-row .btn { padding: 6px 12px; font-size: 12.5px; text-decoration: none; }
.subj-qr .sq-url { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--mist); margin-top: 6px; word-break: break-all; }
@media (max-width: 560px) { .subj-qr { flex-direction: column; align-items: flex-start; } }
html.sth-all a.unit-card { visibility: visible; }
html.sth-all:not(.sth-teacher) .rail .brand a.home:not(.hub) { display: inline !important; }
html.sth-all:not(.sth-teacher) .hero a.back { display: none !important; }
/* 크게 보기 — 그림 + 조작 칸을 화면 가득(theme.js) */
html.sth-big-on, html.sth-big-on body { overflow: hidden; }
.cv-big-row { display: flex; justify-content: flex-end; padding: 6px 10px; background: var(--card); border-bottom: 3px solid var(--line); }
.cv-big-btn { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 13px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.cv-big-btn:hover { border-color: var(--brand); }
.sth-big { position: fixed !important; inset: 0; z-index: 9000; margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; max-width: none !important; overflow: auto !important; -webkit-overflow-scrolling: touch; background: var(--card); }
.sth-big .cv-big-row { display: none; }
.cv-read { display: none; border-bottom: 3px solid var(--line); background: var(--card); }
.cv-read summary { padding: 10px 14px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.cv-read-body { padding: 0 14px 12px; }
.cv-read-body p { margin: 0 0 6px; font-size: 14.5px; line-height: 1.55; color: var(--ink); word-break: keep-all; }
.sth-big .cv-read { display: none !important; }
@media (max-width: 780px) { .cv-read { display: block; } }
@media print { .cv-read { display: none !important; } }
.sth-big .canvas-wrap { margin-left: auto; margin-right: auto; }
.big-bar { position: sticky; top: 0; left: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 6px 12px; background: var(--card); border-bottom: 2px solid var(--line); }
.big-bar .big-close { flex: none; white-space: nowrap; }
.big-bar .big-hint { flex: 1 1 auto; font-size: 12.5px; line-height: 1.4; color: var(--mist); }
/* 대표 그림 크게 보기 */
.hero-art { position: relative; }
.hero-art img { height: auto; cursor: zoom-in; }
.hero-zoom { position: absolute; top: 10px; left: 10px; font: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; border: 1.5px solid rgba(18, 32, 58, .25); background: rgba(255, 255, 255, .92); color: #12203a; cursor: pointer; }
.art-note { display: block; margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: #4a5a72; }
.art-full .art-note { color: #b9c6e6; }
.art-full { position: fixed; inset: 0; z-index: 9000; overflow: auto; background: #0a101c; text-align: center; }
.art-full img { display: block; width: 100%; max-width: min(100vw, calc(100vh - 56px)); height: auto; margin: 0 auto; }
.art-full .art-bar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: flex-end; padding: 8px 12px; }
.art-full .art-cap { max-width: 760px; margin: 0 auto; padding: 14px 18px 28px; color: #e8ecff; font-size: 14.5px; line-height: 1.75; text-align: left; }
.art-full .art-cap b { display: block; font-size: 17px; margin-bottom: 6px; }

/* 첫 추리 — 짝과 이야기한 뒤 다시 고르기 · 우리 반 투표 (theme.js sthGate) */
.gate-rv { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--mist); }
.gate-rv .rv-msg b { color: var(--ink); }
.gate-rv .btn { padding: 6px 13px; font-size: 12.5px; }
.gate-rv .rv-st { font-size: 12.5px; }
.gate .opt.again { border-color: var(--violet); background: var(--violet-100); color: var(--violet-700); }
.gate .opt.first-ghost { outline: 2px dashed var(--line); outline-offset: 2px; }

/* 그림 무대 색 — 이야기 단원의 캔버스는 라이트·다크 모드와 관계없이 이 어두운 무대 색으로 그린다(theme.js cssVar). */
.sth-stage {
  --bg: #070a1f;
  --card: #111a3d;
  --card-2: #17214a;
--rail: #0c1c28;
  --ink: #e8ecff;
  --mist: #9fb0e0;
  --line: #2b3768;
--brand: #4fc3ec;
--brand-dim: #7fd4f2;
--brand-100: #10323f;
--brand-700: #8ad9f5;
--teal: #2ed3bd;
--teal-100: #0e332f;
--teal-700: #74e2d1;
--coral: #ff9d63;
--coral-100: #3a2415;
--coral-700: #ffbb91;
--violet: #a288f5;
--violet-100: #241d3d;
--violet-700: #c5b4fb;
--amber: #ffc42e;
--amber-100: #3a2f0e;
--amber-700: #ffda7c;
--rose: #ff86a6;
--rose-100: #3a1c26;
--rose-700: #ffafc4;
--green: #63c97a;
--green-100: #16301d;
--green-700: #99e0a8;
--on-accent: #06202c;
--glass: rgba(16, 34, 47, .85);
--thumb-ring: #10222f;
--shadow-card: 0 10px 24px -8px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35);
--shadow-pop: 0 16px 34px -10px rgba(0, 0, 0, .7);
--shadow-brand: 0 6px 14px -4px rgba(79, 195, 236, .35);

  --panel: #0d1431;
  --panel-2: #141c42;
}

/* 밝은 스튜디오 색 — 응용 실험실·실제 자료 캔버스(lab.js)와 블록 모형 장면은 라이트·다크 모드와 관계없이 이 밝은 색으로 그린다(theme.js cssVarStudio). */
.sth-studio {
--bg: #eef6fb;
  --card: #ffffff;
  --card-2: #eef2f7;
--rail: #ffffff;
--ink: #12203a;
--mist: #5c7086;
  --line: #c9d3df;
--brand: #3db7e8;
--brand-dim: #1f96c9;
--brand-100: #d9f0fb;
--brand-700: #1179a6;
--teal: #14b8a6;
--teal-100: #ccfbf1;
--teal-700: #0f766e;
--coral: #ff9752;
--coral-100: #ffe8d3;
--coral-700: #c2590f;
--violet: #8b6bf0;
--violet-100: #ece5fd;
--violet-700: #6234c9;
--amber: #ffb800;
--amber-100: #fff2cc;
--amber-700: #a86a00;
--rose: #ff6b93;
--rose-100: #ffe0e9;
--rose-700: #c23864;
--green: #4cb963;
--green-100: #dcf5e1;
--green-700: #1f7a37;
/* 강조색 위에 얹는 글자색 / 유리 배경 / 슬라이더 손잡이 테두리 */
--on-accent: #ffffff;
--glass: rgba(255, 255, 255, .88);
--thumb-ring: #ffffff;
--shadow-card: 0 10px 24px -8px rgba(18, 32, 58, .12), 0 2px 6px rgba(18, 32, 58, .06);
--shadow-pop: 0 16px 34px -10px rgba(18, 32, 58, .2);
--shadow-brand: 0 6px 14px -4px rgba(61, 183, 232, .55);
/* 예전 단원 페이지가 아직 쓰는 이름들 (캔버스 cssVar 포함) */
--abyss: var(--bg);
  --panel: #f6f8fb;
  --panel-2: #eef2f7;
--foam: var(--ink);
--teal-dim: var(--teal-700);
--cold: var(--brand);
--good: var(--green);
--warn: var(--coral);

}
