/* 수업 슬라이드 공통 스타일. 1280×720 무대를 창 크기에 맞춰 늘리고 줄인다. */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --rose: #f7cac9;      /* 세븐틴 공식 색: Rose Quartz */
  --serenity: #92a8d1;  /* 세븐틴 공식 색: Serenity */
  --rose-deep: #e0828a;
  --blue-deep: #4f6fa8;
  --ink: #2b2d42;
  --soft: #6b7089;
  --paper: #fffaf8;
  --ok: #2e9e6a;
  --bad: #d64545;
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1d1f2e; font-family: var(--font); color: var(--ink); }

/* ---------- 무대 ---------- */
#viewport { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; }
#stage { width: 1280px; height: 720px; position: absolute; left: 50%; top: 50%; transform-origin: center center; transform: translate(-50%, -50%); }
.slide {
  position: absolute; inset: 0; display: none; flex-direction: column;
  padding: 56px 72px 64px; background: var(--paper); overflow: hidden;
  border-radius: 6px;
}
.slide.active { display: flex; }
/* 제목은 위에, 나머지 내용은 남은 공간 가운데에 */
.slide.active > h2, #guide .slide > h2 { margin-bottom: auto; }
.slide::after { content: ""; margin-top: auto; }
.slide.cover::after { display: none; }
.slide .notes { display: none; }

#progress { position: fixed; left: 0; bottom: 0; height: 5px; background: linear-gradient(90deg, var(--rose-deep), var(--blue-deep)); transition: width .3s; z-index: 5; }
#counter { position: fixed; right: 14px; bottom: 12px; color: #9aa0b8; font-size: 13px; z-index: 5; }
#help { position: fixed; left: 14px; bottom: 12px; color: #6b7089; font-size: 12px; z-index: 5; transition: opacity 1s; }
#help.gone { opacity: 0; }

/* ---------- 글자 ---------- */
.slide h1 { font-size: 64px; margin: 0 0 12px; letter-spacing: -1px; line-height: 1.15; }
.slide h2 { font-size: 44px; margin: 0 0 22px; letter-spacing: -0.5px; }
.slide h2 small { font-size: 22px; color: var(--soft); font-weight: 500; margin-left: 12px; letter-spacing: 0; }
.slide p, .slide li { font-size: 28px; line-height: 1.5; }
.kicker { font-size: 18px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--blue-deep); margin-bottom: 10px; }
.muted { color: var(--soft); }
.big { font-size: 140px; font-weight: 800; line-height: 1; }
.huge { font-size: 220px; font-weight: 800; line-height: 1; }
.en { font-size: 22px; color: var(--soft); }
.hl { background: linear-gradient(transparent 55%, var(--rose) 55%); padding: 0 4px; }
.blue { color: var(--blue-deep); }
.rose { color: var(--rose-deep); }

/* 배경 장식 */
.slide.cover, .slide.title { background: linear-gradient(135deg, var(--rose) 0%, #fdeff0 45%, #e3eaf7 70%, var(--serenity) 100%); }
.slide.dark { background: #22253a; color: #fff; }
.slide.dark .muted, .slide.dark .en { color: #b7bdd6; }

/* ---------- 배치 도우미 ---------- */
.row { display: flex; gap: 28px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 14px; }
.grow { flex: 1; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; flex: 1; }
.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }

/* ---------- 카드 ---------- */
.card {
  background: #fff; border-radius: 22px; padding: 22px 24px;
  box-shadow: 0 6px 24px rgba(43, 45, 66, .08); text-align: center;
}
.card .big { font-size: 96px; }
.card .say-hint { font-size: 18px; color: var(--soft); margin-top: 6px; }
.letter { font-size: 130px; font-weight: 800; line-height: 1.05; }
.letter.v { color: var(--blue-deep); }   /* 모음 = 파랑 */
.letter.c { color: var(--rose-deep); }   /* 자음 = 분홍 */
.v { color: var(--blue-deep); }
.c { color: var(--rose-deep); }

/* 사진 단어 카드 */
.pic { border-radius: 22px; overflow: hidden; background: #fff; box-shadow: 0 6px 24px rgba(43,45,66,.1); display: flex; flex-direction: column; }
.pic img { width: 100%; height: 230px; object-fit: cover; display: block; }
.pic .word { font-size: 54px; font-weight: 800; padding: 10px 0 2px; text-align: center; }
.pic .mean { font-size: 20px; color: var(--soft); text-align: center; padding-bottom: 12px; min-height: 36px; }

/* 클릭하면 보이는 것 */
.hide-until { cursor: pointer; }
.hide-until .answer { visibility: hidden; }
.hide-until.shown .answer { visibility: visible; }
.hide-until:not(.shown)::after { content: "click"; font-size: 14px; color: #b7bdd6; display: block; }

/* 차례로 나오는 것 (스페이스/→) */
.frag { opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .35s; }
.frag.on { opacity: 1; transform: none; }


/* 맞음/틀림 */
.ok, .bad { font-size: 28px; padding: 14px 22px; border-radius: 16px; display: flex; gap: 14px; align-items: center; }
.ok { background: #e6f6ee; }
.bad { background: #fdeaea; }
.ok b, .bad b { font-size: 30px; }

/* 블록 조립 그림 */
.block { display: inline-grid; border: 4px dashed var(--serenity); border-radius: 18px; width: 200px; height: 200px; padding: 10px; font-weight: 800; }
.block.side { grid-template-columns: 1fr 1fr; align-items: center; justify-items: center; font-size: 96px; }
.block.top { grid-template-rows: 1fr 1fr; align-items: center; justify-items: center; font-size: 84px; }
.plus { font-size: 60px; color: var(--soft); font-weight: 300; }

/* ---------- 영상 클립 ---------- */
.clip { display: flex; gap: 32px; align-items: center; }
.clip .screen {
  width: 768px; height: 432px; flex: none; border-radius: 18px; overflow: hidden; position: relative; background: #000 center/cover no-repeat;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.clip .screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.clip .play {
  position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; background: rgba(0,0,0,.18);
}
.clip .play span { width: 104px; height: 104px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; font-size: 44px; color: var(--rose-deep); padding-left: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.clip .side { flex: 1; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.clip .line { font-size: 38px; font-weight: 700; line-height: 1.4; }
.clip .line mark { background: var(--rose); border-radius: 6px; padding: 0 4px; }
.clip .trans { font-size: 24px; color: var(--soft); }
.clip .who { font-size: 16px; color: var(--soft); }
.clip .ctrl { display: flex; gap: 10px; margin-top: 6px; }
/* 긴 클립: 화면 위, 자막 줄 아래, 버튼은 맨 아래 한 줄 */
.clip.long { flex-direction: column; gap: 10px; align-items: stretch; }
.clip.long .screen { width: 768px; height: 432px; margin: 0 auto; }
.clip.long .capbar { width: 768px; margin: 0 auto; min-height: 78px; padding: 6px 20px; border-radius: 14px; background: #fff; box-shadow: 0 2px 10px rgba(43,45,66,.08); text-align: center; }
.clip.long .capbar .ko { font-size: 32px; font-weight: 700; line-height: 1.3; visibility: hidden; }
.clip.long .capbar .en { font-size: 20px; color: var(--soft); visibility: hidden; }
.clip.long.caps-on .capbar .ko { visibility: visible; }
.clip.long.caps-on.en-on .capbar .en { visibility: visible; }
.clip.long .side { flex-direction: row; align-items: center; justify-content: center; gap: 24px; }
.clip.long .side .who { margin-left: auto; }
.clip.long .caps { display: none; }
.btn.on { background: var(--rose); }
/* 보기 전 미리 읽는 핵심 문장용: 자막 목록을 보이게 하고 싶을 때 */
.caps.show { display: block; list-style: none; padding: 0; margin: 0; }
.caps.show li { font-size: 30px; font-weight: 700; padding: 6px 12px; border-radius: 8px; }
.caps.show li i { font-style: normal; font-size: 20px; color: var(--soft); margin-left: 12px; }
.caps.show li.now { background: var(--rose); }
.btn { font: 600 18px var(--font); border: 0; border-radius: 999px; padding: 10px 18px; background: #fff; color: var(--ink); box-shadow: 0 2px 10px rgba(43,45,66,.12); cursor: pointer; }
.btn:hover { background: var(--rose); }
.credit { position: absolute; left: 72px; bottom: 22px; font-size: 13px; color: #9aa0b8; }

/* ---------- 퀴즈 ---------- */
.quiz { display: flex; gap: 22px; justify-content: center; }
.quiz button { font: 800 96px var(--font); width: 220px; height: 200px; border-radius: 28px; border: 4px solid transparent; background: #fff; box-shadow: 0 6px 24px rgba(43,45,66,.1); cursor: pointer; color: var(--ink); }
.quiz button.picked { border-color: var(--serenity); background: #eef2fa; }
.quiz button.right { border-color: var(--ok); background: #e6f6ee; }
.quiz button.wrong { border-color: var(--bad); background: #fdeaea; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- 선생님 화면 (#presenter) ---------- */
body.presenter { background: #f4f2f6; overflow: auto; }
body.presenter #viewport, body.presenter #progress, body.presenter #help { display: none; }
#presenter { display: none; }
body.presenter #presenter { display: grid; grid-template-columns: 1fr 340px; gap: 20px; padding: 20px; min-height: 100%; }
#presenter .notes-box { background: #fff; border-radius: 16px; padding: 24px 28px; font-size: 19px; line-height: 1.6; }
#presenter .notes-box h3 { margin: 0 0 4px; font-size: 26px; }
#presenter .side-box { display: flex; flex-direction: column; gap: 14px; }
#presenter .panel { background: #fff; border-radius: 16px; padding: 16px 18px; }
#presenter .timer { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
#presenter .nav { display: flex; gap: 10px; }
#presenter .nav button { flex: 1; font-size: 20px; padding: 14px; }

/* 대본 꾸밈 (선생님 화면, 미리보기 공통) */
.notes .say, .note-view .say { display: block; }
.note-view h4 { margin: 18px 0 6px; font-size: 15px; letter-spacing: 1px; color: var(--blue-deep); }
.note-view h4.ko-h { color: var(--rose-deep); }
.note-view .script { background: #f1f5fc; border-left: 5px solid var(--serenity); padding: 10px 16px; border-radius: 8px; }
.note-view .script p { margin: 6px 0; }
.note-view .script .do { color: #6b7089; font-style: italic; font-size: .9em; }
.note-view .ko { background: #fdf3f3; border-left: 5px solid var(--rose); padding: 10px 16px; border-radius: 8px; }
.note-view .ko p, .note-view .ko li { margin: 6px 0; }
.note-view .min { font-size: 14px; color: var(--soft); }

/* ---------- 전체 미리보기 (?guide) ---------- */
body.guide { background: #f4f2f6; overflow: auto; height: auto; }
body.guide #viewport, body.guide #progress, body.guide #counter, body.guide #help { display: none; }
#guide { display: none; }
body.guide #guide { display: block; padding: 24px; max-width: 1400px; margin: 0 auto; }
#guide .g-item { display: grid; grid-template-columns: 640px 1fr; gap: 24px; margin-bottom: 28px; align-items: start; }
#guide .g-thumb { width: 640px; height: 360px; position: relative; overflow: hidden; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
#guide .g-thumb .slide { display: flex; transform: scale(.5); transform-origin: top left; width: 1280px; height: 720px; }
#guide .g-thumb .frag { opacity: 1; transform: none; }
#guide .g-thumb .hide-until .answer { visibility: visible; }
#guide .note-view { background: #fff; border-radius: 12px; padding: 16px 22px; font-size: 16px; line-height: 1.6; }
#guide .note-view h3 { margin: 0; font-size: 20px; }
@media print {
  #guide .g-item { break-inside: avoid; }
}

/* 대본 창 버튼 · 안내 */
#open-notes { position: fixed; right: 64px; bottom: 6px; z-index: 6; border: 0; background: transparent; font-size: 18px; opacity: .35; cursor: pointer; }
#open-notes:hover { opacity: 1; }
body.presenter #open-notes, body.guide #open-notes { display: none; }
#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: #2b2d42; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 9; opacity: 0; pointer-events: none; transition: opacity .3s; max-width: 80vw; }
#toast.on { opacity: 1; pointer-events: auto; }

/* 자판 그림 */
.kbd-grid { display: grid; gap: 8px; }
.kbd-grid .k { background: #fff; border-radius: 12px; box-shadow: 0 3px 0 #d9dcea, 0 4px 14px rgba(43,45,66,.08); display: grid; place-items: center; font-weight: 800; position: relative; }
.kbd-grid .k small { position: absolute; left: 6px; top: 3px; font-size: 11px; color: #9aa0b8; font-weight: 600; }
.kbd-grid .k.vv { color: var(--blue-deep); background: #eef2fa; }
.kbd-grid .k.cc { color: var(--rose-deep); }
.cji { grid-template-columns: repeat(3, 92px); grid-auto-rows: 64px; font-size: 30px; }
.cji .k.big3 { font-size: 46px; }
.dubeol .row-k { display: flex; gap: 6px; margin-bottom: 6px; }
.dubeol .k { width: 52px; height: 52px; font-size: 24px; }
.lyric { font-size: 46px; font-weight: 800; line-height: 1.5; letter-spacing: 1px; }
.lyric .rd { background: var(--rose); border-radius: 8px; padding: 0 2px; }
.lyric .nr { color: #c3c7d6; }

/* 표 (자음 가족 등) */
.tbl { border-collapse: separate; border-spacing: 8px; margin: 0 auto; }
.tbl th { font-size: 20px; color: var(--soft); font-weight: 600; padding: 0 10px; }
.tbl td { background: #fff; border-radius: 14px; box-shadow: 0 3px 12px rgba(43,45,66,.07); text-align: center; padding: 4px 18px; font-size: 22px; color: var(--soft); }
.tbl td b { display: block; font-size: 46px; color: var(--rose-deep); line-height: 1.1; }
.tbl td.empty { background: transparent; box-shadow: none; }
.pron { color: var(--blue-deep); font-weight: 700; white-space: nowrap; }
.names { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.names .card { padding: 12px 8px; }
.names .big { font-size: 50px; }

/* 블록 모양 그림 */
.shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 22px; }
.shape { text-align: center; }
.sbox { width: 150px; height: 150px; margin: 0 auto; display: grid; gap: 4px; padding: 4px; background: #e3eaf7; border-radius: 14px; }
.sbox > div { background: #fff; border-radius: 8px; display: grid; place-items: center; font-size: 34px; font-weight: 800; }
.sbox .c { color: var(--rose-deep); }
.sbox .v { color: var(--blue-deep); background: #eef2fa; }
.shape .syl { font-size: 40px; font-weight: 800; margin-top: 4px; line-height: 1.1; }
.shape .gl { font-size: 16px; color: var(--soft); }
.shape.boss .sbox { background: var(--rose); }

/* 복습 정리 페이지 */
body.review { background: #fffaf8; height: auto; overflow: auto; }
html:has(body.review) { background: #fffaf8; }
.review-wrap { max-width: 860px; margin: 0 auto; padding: 40px 24px 60px; font-size: 17px; line-height: 1.6; }
.review-wrap h1 { font-size: 30px; margin: 8px 0 6px; }
.review-wrap .help { color: var(--soft); margin: 0 0 16px; }
.review-wrap textarea { width: 100%; min-height: 640px; font: 16px/1.65 var(--font); padding: 18px 20px; border: 1px solid #e3e5ee; border-radius: 14px; background: #fff; color: var(--ink); resize: vertical; }
.review-wrap .bar { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.review-wrap .copied { color: var(--ok); font-weight: 700; opacity: 0; transition: opacity .3s; }
.review-wrap .copied.on { opacity: 1; }

/* 가사 속 빈칸 (클릭하면 정답) */
.lyric .hide-until { border-bottom: 3px dashed var(--rose-deep); padding: 0 4px; min-width: 1.2em; }
.lyric .hide-until:not(.shown)::after { content: none; }

/* 휴대폰·좁은 화면: 전체 보기와 대본 창을 한 줄로 쌓는다 */
html:has(body.guide), html:has(body.presenter) { background: #f4f2f6; }
@media (max-width: 900px) {
  body.guide #guide { padding: 12px; }
  #guide h1 { font-size: 22px; }
  #guide .g-item { grid-template-columns: 1fr; gap: 10px; margin-bottom: 22px; }
  #guide .g-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  #guide .note-view { font-size: 15px; padding: 14px 16px; }
  body.presenter #presenter { grid-template-columns: 1fr; padding: 12px; }
  body.presenter #presenter .side-box { order: -1; }
  #presenter .notes-box { padding: 16px; font-size: 16px; }
}
/* 토막 슬라이드용 작은 긴 클립: 왼쪽에 영상+자막, 오른쪽은 .row 의 다른 열 */
.clip.long.sm { flex: none; width: 600px; }
.clip.long.sm .screen { width: 600px; height: 338px; }
.clip.long.sm .capbar { width: 600px; min-height: 70px; padding: 6px 14px; }
.clip.long.sm .capbar .ko { font-size: 27px; }
.clip.long.sm .capbar .en { font-size: 18px; }
.clip.long.sm .side { flex-wrap: wrap; gap: 8px 14px; }
.clip.long.sm .side .who { margin-left: 0; width: 100%; }
.clip.long.sm .btn { font-size: 16px; padding: 8px 14px; }

/* 여러 영상 골라 듣기: [data-pick] 버튼 목록 (왼쪽 .clip 하나로 재생) */
.picks { display: flex; flex-direction: column; gap: 7px; }
.pick-row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 3px 12px; box-shadow: 0 2px 8px rgba(43,45,66,.06); }
.pick-row [data-pick] { font: inherit; font-size: 22px; font-weight: 700; color: var(--ink); border: 0; background: #fdeceb; border-radius: 10px; padding: 3px 12px; cursor: pointer; white-space: nowrap; }
.pick-row [data-pick]::before { content: "▶ "; font-size: 15px; color: var(--rose-deep); }
.pick-row [data-pick].now { background: var(--rose); box-shadow: inset 0 0 0 2px var(--rose-deep); }
.pick-row .by { font-size: 14px; color: var(--soft); white-space: nowrap; }
.pick-row .hide-until { margin-left: auto; font-size: 18px; white-space: nowrap; border-bottom: 2px dashed var(--rose-deep); min-width: 150px; text-align: right; }
.pick-row .hide-until:not(.shown)::after { content: none; }
.pick-head { font-size: 15px; font-weight: 700; color: var(--soft); margin: 4px 0 -2px; }
