/* 모드 전환, 교사용 패널, 학생용 슬라이드, 게임 */

:root {
  --t0: #e03131; --t1: #1971c2; --t2: #2f9e44; --t3: #f08c00;
  --ok: #2f9e44; --bad: #e03131;
  /* 학생 슬라이드 글자 배율: 사이드바 '가+ 가−' 버튼(--font)에 함께 반응 */
  --s: 1;   /* 숫자(단위 없음). app.js가 글자 크기에 맞춰 바꾼다 */
}

/* ---------- 모드 전환 ---------- */
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 14px 12px; }
.mode-btn {
  min-height: 60px; border: 2px solid var(--side-2); border-radius: 12px;
  background: transparent; color: var(--side-text); font-weight: 500; font-size: 18px;
}
.mode-btn.active { background: #fff; color: var(--side); border-color: #fff; }
.toc-game { display: block; font-size: 13px; color: var(--side-muted); }
.toc-lesson.active .toc-game { color: #dbe7ff; }

/* ---------- 교사용 ---------- */
.attitude {
  background: #fff4e6; border-left: 8px solid #f08c00; color: #5c3200;
  border-radius: 14px; padding: 14px 24px; margin: -10px 0 24px; font-weight: 500;
}
:root[data-theme="dark"] .attitude { background: #3a2a12; color: #ffe0b3; }
.attitude small { display: block; font-size: .65em; color: #d9480f; font-weight: 500; letter-spacing: .08em; }

.timeline { display: grid; gap: 0; }
.tl-row { display: grid; grid-template-columns: 90px 110px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.tl-min { font-weight: 500; font-size: 1.2em; color: var(--accent); }
.tl-step { font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two > .card { margin-bottom: 18px; }
.mode-explain { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 8px; }

.vs-grid { display: grid; grid-template-columns: 1fr 50px 1fr; gap: 12px; align-items: stretch; }
.vs-old, .vs-new { border-radius: 12px; padding: 16px 18px; }
.vs-old { background: var(--bg); color: var(--muted); }
.vs-new { background: var(--accent-soft); font-weight: 500; }
.vs-old small, .vs-new small { display: block; font-weight: 500; font-size: .7em; letter-spacing: .08em; margin-bottom: 4px; }
.vs-arrow { display: grid; place-items: center; font-size: 1.6em; color: var(--accent); }
.vs-teach { margin: 14px 0 0; }

/* ---------- 학생용 슬라이드 ---------- */
body[data-mode="student"] .content { padding: 20px 28px 20px 60px; display: flex; } /* 목차 접기 버튼(◀)이 이전 버튼과 겹치지 않게 왼쪽 여백 확보 */
body[data-mode="student"] .content > * { max-width: none; }
.slide-wrap { flex: 1; display: flex; flex-direction: column; min-height: 100%; }
.slide {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  background: var(--panel); border-radius: 24px; padding: calc(40px * var(--s)) calc(64px * var(--s));
  border-top: 14px solid var(--accent); overflow: auto;
}
.slide.u4 { border-top-color: var(--u4); } .slide.u5 { border-top-color: var(--u5); } .slide.u6 { border-top-color: var(--u6); }
.slide.game { justify-content: flex-start; padding: 24px 32px; }

.s-kicker, .s-label { font-size: calc(26px * var(--s)); font-weight: 500; color: var(--accent); letter-spacing: .02em; margin-bottom: 12px; }
.s-title { font-size: calc(76px * var(--s)); line-height: 1.15; margin: 0 0 24px; letter-spacing: -0.03em; }
.s-one { font-size: calc(44px * var(--s)); line-height: 1.35; margin: 0 0 32px; font-weight: 500; }
.s-goal { font-size: calc(30px * var(--s)); color: var(--muted); border-top: 2px solid var(--line); padding-top: 18px; }
.s-goal small, .exit small, .rc small { display: block; font-size: .65em; font-weight: 500; color: var(--accent); }
.s-icon { font-size: calc(96px * var(--s)); line-height: 1; margin-bottom: 18px; }
.s-point { font-size: calc(58px * var(--s)); line-height: 1.3; margin: 0 0 28px; letter-spacing: -0.02em; font-weight: 500; }
.s-point b, .s-one b, .s-more b, .kw-def b, .rc b { color: var(--accent); }
.s-more, .s-list { font-size: calc(36px * var(--s)); line-height: 1.45; margin: 0; padding-left: 1.1em; color: var(--text); }
.s-more li, .s-list li { margin: 8px 0; }

.kw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(380px * var(--s)), 1fr)); gap: 20px; width: 100%; }
.kw { background: var(--bg); border-radius: 18px; padding: 22px 26px; }
.kw-term { font-size: calc(42px * var(--s)); font-weight: 500; margin-bottom: 6px; }
.kw-def { font-size: calc(30px * var(--s)); line-height: 1.4; }

.rc { display: grid; gap: 14px; width: 100%; }
.rc-old, .rc-new { border-radius: 18px; padding: 24px 30px; font-size: calc(40px * var(--s)); line-height: 1.35; }
.rc-old { background: var(--bg); color: var(--muted); }
.rc-new { background: var(--accent-soft); font-weight: 500; }
.rc-arrow { font-size: calc(40px * var(--s)); text-align: center; color: var(--accent); }

.exit { margin-top: 24px; font-size: calc(40px * var(--s)); background: var(--bg); border-radius: 18px; padding: 24px 30px; width: 100%; font-weight: 500; }

.slide-nav { display: flex; align-items: center; gap: 16px; padding-top: 14px; }
.snav { min-width: 120px; min-height: 76px; border: 0; border-radius: 18px; background: var(--accent); color: var(--on-accent, #fff); font-size: 26px; font-weight: 500; padding: 0 24px; }
.dots { flex: 1; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--line); padding: 0; }
.dot.on { background: var(--accent); transform: scale(1.3); }

/* ---------- 게임 공통 ---------- */
.game-box { width: 100%; }
.game-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.game-type { background: var(--accent); color: var(--on-accent, #fff); padding: 6px 16px; border-radius: 20px; font-weight: 500; font-size: .85em; }
.game-title { font-size: 1.4em; font-weight: 500; flex: 1; }
.timer { display: flex; align-items: center; gap: 8px; }
.timer-time { font-size: 1.8em; font-weight: 500; font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: right; }
.timer-time.warn { color: var(--bad); }
.timer.done .timer-time { animation: blink 1s infinite; }
.timer button, .game-tools button, .q-nav button, .score-reset {
  min-width: 60px; min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); font-weight: 500; padding: 0 14px;
}
@keyframes blink { 50% { opacity: .2; } }

.scoreboard { display: flex; gap: 10px; margin-bottom: 16px; align-items: stretch; }
.team { flex: 1; display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 6px 12px; color: #fff; }
.team.t0 { background: var(--t0); } .team.t1 { background: var(--t1); } .team.t2 { background: var(--t2); } .team.t3 { background: var(--t3); }
.team-name { font-weight: 500; font-size: .85em; }
.team-score { font-size: 1.9em; font-weight: 500; flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
.team-btns { display: grid; gap: 4px; }
.team-btns button { width: 46px; height: 34px; border: 0; border-radius: 8px; background: rgba(255,255,255,.25); color: #fff; font-size: 22px; font-weight: 500; line-height: 1; }

.game-stage { background: var(--bg); border-radius: 18px; padding: 22px; }
.q-count { color: var(--muted); font-weight: 500; }
.q-text { font-size: 1.7em; font-weight: 500; line-height: 1.35; margin: 6px 0 20px; }
.q-text.small { font-size: 1.3em; }
.q-nav { display: flex; justify-content: space-between; margin-top: 18px; }
.q-nav button { font-size: 1em; min-width: 140px; }
.reveal { margin-top: 18px; font-size: 1.15em; background: var(--panel); border-radius: 14px; padding: 16px 20px; border-left: 8px solid var(--ok); }

.ox-btns { display: flex; gap: 24px; }
.ox { flex: 1; min-height: 150px; border-radius: 24px; border: 0; font-size: 100px; font-weight: 500; color: #fff; }
.ox.o { background: #1c7ed6; } .ox.x { background: #e03131; }
.ox.dim, .choice.dim { opacity: .3; }
.ox.right { outline: 8px solid var(--ok); outline-offset: 4px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { display: flex; align-items: center; gap: 14px; min-height: 90px; text-align: left; padding: 12px 20px; border-radius: 16px; border: 3px solid var(--line); background: var(--panel); font-size: 1.15em; font-weight: 500; }
.choice .cn { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--on-accent, #fff); display: grid; place-items: center; }
.choice.right { border-color: var(--ok); background: #ebfbee; color: #1b4b24; }
.choice.wrong { border-color: var(--bad); background: #fff5f5; color: #5c1a1a; }

.order-slots { display: grid; gap: 8px; margin-bottom: 18px; }
.slot { min-height: 60px; border: 3px dashed var(--line); border-radius: 14px; padding: 12px 18px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 12px; }
.slot.filled { border-style: solid; border-color: var(--ok); color: var(--text); background: var(--panel); }
.slot.filled b { color: var(--ok); }
.cards { display: flex; flex-wrap: wrap; gap: 12px; }
.card-btn, .m-item { min-height: 72px; padding: 12px 22px; border-radius: 14px; border: 3px solid var(--line); background: var(--panel); font-size: 1.05em; font-weight: 500; text-align: left; }
.game-tools { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 16px; }
.cheer { font-size: 1.4em; font-weight: 500; color: var(--ok); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.m-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.m-item.ok { border-color: hsl(var(--h), 65%, 45%); background: hsl(var(--h), 80%, 92%); color: hsl(var(--h), 60%, 20%); }

.sort-card { position: relative; min-height: 130px; display: grid; place-items: center; text-align: center; font-size: 1.6em; font-weight: 500; background: var(--panel); border-radius: 18px; padding: 20px 30px; margin-bottom: 18px; border: 3px solid var(--accent); }
.sc-n { position: absolute; top: 10px; left: 16px; font-size: .5em; color: var(--muted); }
.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.bucket { background: var(--panel); border-radius: 16px; padding: 10px; border: 2px solid var(--line); }
.bucket-btn { width: 100%; min-height: 80px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent, #fff); font-size: 1.2em; font-weight: 500; }
.bucket-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bucket-items span { background: var(--bg); border-radius: 8px; padding: 4px 10px; font-size: .8em; }

.rules { font-size: 1.05em; margin: 0 0 16px; }
.missions { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mission { background: var(--panel); border-radius: 16px; padding: 16px 18px; border: 2px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.m-head { display: flex; justify-content: space-between; font-weight: 500; }
.m-no { color: var(--accent); } .m-pts { background: #fff3bf; color: #5c4400; border-radius: 10px; padding: 0 10px; }
.m-title { font-size: 1.2em; font-weight: 500; line-height: 1.3; }
.m-goal { color: var(--muted); flex: 1; }
.m-teams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.m-team { min-height: 52px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); font-weight: 500; font-size: .8em; }
.m-team.done.t0 { background: var(--t0); color: #fff; border-color: var(--t0); }
.m-team.done.t1 { background: var(--t1); color: #fff; border-color: var(--t1); }
.m-team.done.t2 { background: var(--t2); color: #fff; border-color: var(--t2); }
.m-team.done.t3 { background: var(--t3); color: #fff; border-color: var(--t3); }
.m-team.done::before { content: "✓ "; }

.shake { animation: shake .4s; border-color: var(--bad) !important; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

@media (max-width: 900px) {
  .two, .mode-explain, .choices, .match { grid-template-columns: 1fr; }
  .vs-grid { grid-template-columns: 1fr; } .vs-arrow { transform: rotate(90deg); }
  .tl-row { grid-template-columns: 60px 1fr; } .tl-do { grid-column: 1 / -1; }
  .slide { padding: 24px; }
  .scoreboard { flex-wrap: wrap; } .team { flex: 1 1 45%; }
}

/* ---------- 재미 요소: 궁금증 질문, 잠깐 퀴즈, 페이지 전환, 발표자 뽑기 ---------- */
.tools { grid-template-columns: repeat(4, 1fr); }
.tool-btn.wide { grid-column: span 3; font-size: 18px; }

.slide.enter > * { animation: rise .35s ease both; }
.slide.enter > *:nth-child(2) { animation-delay: .06s; }
.slide.enter > *:nth-child(3) { animation-delay: .12s; }
.slide.enter > *:nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.s-icon.big { font-size: calc(140px * var(--s)); animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.06); } }
.slide.hook { background: linear-gradient(135deg, var(--panel) 60%, #fff3bf); }
.slide.check { background: linear-gradient(135deg, var(--panel) 60%, #e7f5ff); }
:root[data-theme="dark"] .slide.hook, :root[data-theme="dark"] .slide.check { background: var(--panel); }
.slide.hook .s-label { color: #e67700; } .slide.check .s-label { color: #1971c2; }

.reveal-btn {
  min-height: calc(90px * var(--s)); padding: 0 calc(40px * var(--s)); border: 0; border-radius: 999px;
  background: #fab005; color: #3b2a00; font-size: calc(36px * var(--s)); font-weight: 500;
  box-shadow: 0 8px 0 #e67700; animation: pulse 1.6s ease-in-out infinite;
}
.reveal-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #e67700; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.reveal-box {
  font-size: calc(40px * var(--s)); line-height: 1.4; font-weight: 500; width: 100%;
  background: #ebfbee; color: #1b4b24; border-radius: 20px; padding: 24px 32px; border-left: 12px solid var(--ok);
  animation: pop .4s ease;
}
.reveal-box b { color: #087f5b; }
@keyframes pop { 0% { transform: scale(.8); opacity: 0; } 70% { transform: scale(1.03); } 100% { transform: none; opacity: 1; } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 15, 25, .65); display: grid; place-items: center; }
.picker { position: relative; background: var(--panel); color: var(--text); border-radius: 28px; padding: 36px 56px; width: min(720px, 92vw); text-align: center; }
.ov-close { position: absolute; top: 14px; right: 14px; width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--bg); font-size: 24px; }
.pk-title { font-size: 34px; font-weight: 500; }
.pk-num { font-size: 200px; font-weight: 500; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.pk-num.pop { animation: pop .5s ease; }
.pk-sub { font-size: 34px; font-weight: 500; margin-bottom: 18px; }
.pk-go { min-width: 260px; min-height: 90px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent, #fff); font-size: 38px; font-weight: 500; }
.pk-go:disabled { opacity: .5; }
.pk-set { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; margin-top: 22px; font-size: 20px; }
.pk-set button { width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); font-size: 22px; margin: 0 8px; }
.pk-chk input { width: 26px; height: 26px; vertical-align: middle; }
.pk-used { margin-top: 14px; color: var(--muted); font-size: 18px; }

/* ---------- 설정, 압축 차시, 이야기 ---------- */
.plan-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 12px; }
.plan-opt { display: grid; gap: 6px; text-align: left; padding: 22px 26px; border-radius: 18px; border: 3px solid var(--line); background: var(--panel); }
.plan-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.po-num { font-size: 3em; font-weight: 500; line-height: 1; color: var(--accent); }
.po-num small { font-size: .35em; margin-left: 4px; }
.po-name { font-size: 1.2em; font-weight: 500; }
.po-desc { color: var(--muted); }
.po-units { font-weight: 500; }
.btn-link { display: inline-flex; align-items: center; min-height: 60px; padding: 0 26px; border-radius: 14px; background: var(--accent); color: var(--on-accent, #fff); text-decoration: none; font-weight: 500; }
code { background: var(--bg); padding: 2px 8px; border-radius: 6px; }

.card.compact { border-left: 8px solid #f08c00; }
.mod-pick { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.mod-btn { min-height: 56px; padding: 0 20px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); font-weight: 500; }
.mod-btn.on { border-color: #f08c00; background: #fff4e6; color: #5c3200; }

.card.story p { line-height: 1.85; margin: 0 0 14px; }
.story-q, .s-story-q { font-weight: 500; color: var(--accent); }

.slide.story { justify-content: flex-start; }
.s-mod { background: #f08c00; color: #fff; border-radius: 10px; padding: 2px 12px; margin-right: 10px; font-size: .8em; }
.s-story-title { font-size: calc(44px * var(--s)); margin: 0 0 16px; }
.s-story { font-size: calc(28px * var(--s)); line-height: 1.8; max-width: 1300px; }
.s-story p { margin: 0 0 14px; }
.s-story-q { font-size: calc(34px * var(--s)); background: var(--accent-soft); border-radius: 16px; padding: 18px 24px; margin-top: 8px; }
.s-point.q { font-size: calc(46px * var(--s)); }
.slide-choices { width: 100%; font-size: calc(26px * var(--s)); }
.slide-choices .choice { min-height: calc(100px * var(--s)); }
.slide.check .reveal-box { margin-top: 18px; font-size: calc(30px * var(--s)); }

/* ---------- 학습 목표·태도 목표 접기 ---------- */
.goals { margin: 0 0 20px; }
.goals > summary {
  list-style: none; display: flex; align-items: center; gap: 14px; cursor: pointer;
  min-height: 48px; padding: 6px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  margin-bottom: 10px; user-select: none;
}
.goals > summary::-webkit-details-marker { display: none; }
.goals-label { font-weight: 500; color: var(--accent); flex: 0 0 auto; }
.goals-peek { flex: 1; min-width: 0; color: var(--muted); font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goals[open] .goals-peek { visibility: hidden; }
.goals-toggle { flex: 0 0 auto; font-size: .85em; color: var(--muted); }
.goals-toggle::after { content: "펼치기 ▾"; }
.goals[open] .goals-toggle::after { content: "접기 ▴"; }
.goals .objective { margin-bottom: 12px; }
.goals .attitude { margin: 0; }

/* ---------- 계단 설명 페이지 ---------- */
.slide.explain { justify-content: center; }
.s-count { margin-left: 10px; font-weight: 300; color: var(--muted); }
.s-step-title { font-size: calc(34px * var(--s)); font-weight: 500; margin: 0 0 18px; color: var(--muted); }
.s-head { font-size: calc(52px * var(--s)); line-height: 1.3; font-weight: 500; margin: 0 0 28px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 18px; }
.s-head b { color: var(--accent); font-weight: 500; }
.s-head-icon { font-size: 1.3em; }
.s-lines { font-size: calc(36px * var(--s)); line-height: 1.5; margin: 0; padding-left: 1.1em; font-weight: 400; }
.s-lines li { margin: 12px 0; }
.s-lines b { color: var(--accent); font-weight: 500; }
.s-lines li.new { list-style: none; margin-left: -1.1em; background: #fff4e6; border-radius: 14px; padding: 10px 18px; }
:root[data-theme="dark"] .s-lines li.new { background: #3a2a12; }
.new-tag { display: inline-block; background: #f08c00; color: #fff; font-size: .6em; font-weight: 500; border-radius: 8px; padding: 2px 10px; margin-right: 12px; vertical-align: middle; }
.s-tb { margin-top: auto; padding-top: 24px; align-self: flex-end; font-size: calc(22px * var(--s)); font-weight: 300; color: var(--muted); }

/* 쪽수가 많을 때 진행 막대 */
.page-bar { flex: 1; max-width: 640px; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.page-bar span { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .2s; }
.page-count { min-width: 90px; text-align: center; font-size: 20px; font-weight: 500; color: var(--muted); }


/* ---------- 줄 간격 조금 줄이기 (단락 간격은 그대로) ---------- */
body { line-height: 1.5 !important; }
.s-story { line-height: 1.6 !important; }
.story-block p, .board .story-block p { line-height: 1.65 !important; }
.step-body p, .board .step-body p { line-height: 1.6 !important; }
.card.story p { line-height: 1.6 !important; }
.s-lines, .s-more, .s-list { line-height: 1.38 !important; }
.s-point { line-height: 1.22 !important; }
.s-head { line-height: 1.22 !important; }
.s-one { line-height: 1.28 !important; }
.tb-quote, .step-quote { line-height: 1.5 !important; }
.kw-def, .rc-old, .rc-new { line-height: 1.32 !important; }


/* ---------- 접근성: 키보드 포커스 윤곽선, 움직임 줄이기 ---------- */
:root { --focus: #1971c2; }
:root[data-theme="dark"] { --focus: #74c0fc; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .xp-toast, .toast { animation: none !important; }   /* 끝 모양이 투명이라 애니메이션을 끄면 바로 사라지므로 */
  .confetti { display: none; }
}

/* 글자 크기 +/- (기본 화면: 본문 배율) */
 body:not(.board) .main { zoom: var(--page-zoom, 1); }
 .top-btn:disabled { opacity: .4; cursor: default; }
