/* 초니쌤의 정보수업 허브 — 입장 코드는 크게, 수업 카드는 학년 색으로, 크롬북·휴대폰·TV에서 보기 좋게. */
:root {
  --bg: #faf7f2; --surface: #ffffff; --ink: #1d2433; --muted: #5a6376; --line: #e9e3d9;
  --brand: #3949c7; --brand-deep: #26318f; --brand-soft: #eef0ff; --warm: #d9480f;
  --sun: #ffd43b; --sun-deep: #fcc419;
  --g4: #f08c00; --g4-ink: #b85600; --g4-soft: #fff4e6;
  --g5: #2b8a3e; --g5-ink: #2b8a3e; --g5-soft: #ebfbee;
  --g6: #9c36b5; --g6-ink: #862e9c; --g6-soft: #f8f0fc;
  --tools: #3b5bdb; --tools-ink: #3b5bdb; --tools-soft: #edf2ff;
  --danger: #c92a2a;
  --radius: 20px; --max: 1100px;
  --shadow: 0 1px 2px rgba(29, 36, 51, .05), 0 8px 24px rgba(29, 36, 51, .07);
  --shadow-up: 0 2px 4px rgba(29, 36, 51, .06), 0 16px 36px rgba(29, 36, 51, .11);
  --focus: 0 0 0 3px var(--surface), 0 0 0 6px var(--brand);
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0 16px 56px; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 18px; line-height: 1.6; overflow-x: hidden; word-break: keep-all; overflow-wrap: anywhere;
}
.page { max-width: var(--max); margin: 0 auto; }
a { color: inherit; }

/* ---- 머리말 ---- */
.hub-top {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px;
  padding: 40px 0 24px;
}
.kicker {
  display: inline-block; margin: 0; padding: 4px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-deep); font-size: .95rem; font-weight: 700;
}
.wordmark { margin: 12px 0 10px; font-size: clamp(2.3rem, 7vw, 4rem); line-height: 1.12; font-weight: 900; letter-spacing: -.02em; }
.wm-a { color: var(--brand-deep); }
.wm-b { color: var(--warm); }
.lead { margin: 0; max-width: 34em; color: var(--muted); font-size: 1.1rem; }
.hub-art { width: clamp(150px, 22vw, 230px); height: auto; display: block; }

/* ---- 안내 띠 ---- */
.entry-wrap { margin: 0 0 8px; }
.blocked {
  margin: 0 0 12px; padding: 12px 18px; border-radius: 14px;
  background: #fff4e5; border: 1px solid #ffd8a8; color: #8a4b00; font-weight: 700;
}
.teacher-hint {
  margin: 12px 0 0; padding: 14px 18px; border-radius: 16px;
  background: var(--brand-soft); color: var(--brand-deep); font-size: 1.02rem; line-height: 1.6;
}
.hint-pill { white-space: nowrap; font-weight: 800; }
.lesson-note[hidden], .blocked[hidden], .teacher-hint[hidden] { display: none; }

/* ---- 학년별 수업 카드 ---- */
.hub-main { margin: 0; }
.grade { --tone: var(--brand); --tone-ink: var(--brand); --tone-soft: var(--brand-soft); margin-top: 36px; }
.tone-g4 { --tone: var(--g4); --tone-ink: var(--g4-ink); --tone-soft: var(--g4-soft); }
.tone-g5 { --tone: var(--g5); --tone-ink: var(--g5-ink); --tone-soft: var(--g5-soft); }
.tone-g6 { --tone: var(--g6); --tone-ink: var(--g6-ink); --tone-soft: var(--g6-soft); }
.tone-tools { --tone: var(--tools); --tone-ink: var(--tools-ink); --tone-soft: var(--tools-soft); }
.grade-title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  color: var(--tone-ink); font-size: 1.35rem; font-weight: 900;
}
.grade-title::before { content: ''; width: 14px; height: 14px; border-radius: 4px; background: var(--tone); flex: none; }
.grade-title::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: var(--tone-soft); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.lesson {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .14s ease, box-shadow .14s ease;
}
.lesson::before { content: ''; height: 8px; background: var(--tone); flex: none; }
.lesson:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.lesson:focus-within { box-shadow: var(--shadow-up); }
.lesson-main {
  flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 20px 22px 20px;
  color: inherit; text-decoration: none; min-height: 210px; border-radius: 0 0 var(--radius) var(--radius);
}
.lesson-main:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--brand); }
.lesson-head { display: flex; align-items: center; gap: 12px; }
.emoji {
  display: grid; place-items: center; width: 56px; height: 56px; flex: none;
  border-radius: 16px; background: var(--tone-soft); font-size: 1.9rem; line-height: 1;
}
.subject { color: var(--tone-ink); font-size: .92rem; font-weight: 700; line-height: 1.35; }
.title { margin-top: 8px; font-size: 1.5rem; font-weight: 900; line-height: 1.3; }
.desc { color: var(--muted); }
.lesson-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.go {
  margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: var(--tone-soft); color: var(--tone-ink); font-weight: 900; transition: transform .14s ease, background .14s ease;
}
.lesson:hover .go { transform: translateX(3px); background: var(--tone); color: #fff; }

/* 수업 카드 상태 배지·안내 */
.badge {
  padding: 3px 12px; border-radius: 999px; font-size: .88rem; font-weight: 800;
  border: 1px solid var(--line); background: #f3f1ec; color: var(--muted);
}
.badge.is-open { background: #ebfbee; border-color: #b2f2bb; color: #2b8a3e; }
.badge.is-closed { background: #f1f3f5; border-color: #dee2e6; color: #495057; }
.lesson-note { margin: 0; padding: 0 22px 18px; color: var(--danger); font-weight: 700; font-size: .95rem; }
.lesson-note.is-success { color:#286147; }
.lesson-teacher-controls:not([hidden]) { display:flex; flex-wrap:wrap; gap:8px; padding:12px 22px; border-top:1px solid var(--line); background:#f5f6ff; }
.hub-teacher-action { flex:1; min-height:42px; border:1px solid #d5daf0; border-radius:9px; padding:8px 10px; background:#fff; color:#263769; font:inherit; font-size:.85rem; font-weight:750; cursor:pointer; }
.hub-teacher-action:hover:not(:disabled) { background:#eaf0ff; }
.hub-teacher-action:focus-visible { outline:none; box-shadow:var(--focus); }
.hub-teacher-action:disabled { color:#7b8398; background:#f7f8fb; cursor:default; }
.hub-teacher-action[aria-pressed=true] { color:#22634d; background:#eaf6ef; }
.lesson.has-note .lesson-main { min-height: 0; padding-bottom: 8px; }

/* 선생님 기기: 배지 자리에 겹쳐 놓은 열기·닫기 버튼(링크 밖에 두려고 음수 여백으로 끌어올린다) */
.badge.is-ghost { visibility: hidden; }
.badge-toggle {
  position: relative; z-index: 1; align-self: flex-start; box-sizing: border-box;
  height: 34px; margin: -57px 0 23px 22px; display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: .88rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 1px 2px rgba(29, 36, 51, .12); transition: box-shadow .14s ease, transform .14s ease;
}
.badge-toggle:hover:not(:disabled) { box-shadow: 0 3px 10px rgba(29, 36, 51, .18); transform: translateY(-1px); }
.badge-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
.badge-toggle:disabled { cursor: progress; opacity: .75; }
.toggle-act { padding: 1px 8px; border-radius: 999px; background: rgba(29, 36, 51, .09); font-size: .8rem; }
.lesson.has-toggle.has-note .lesson-main { padding-bottom: 20px; }

/* ---- 선생님 공간 ---- */
.teacher-space {
  margin-top: 48px; padding: 18px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px dashed #d8d0c2;
}
.teacher-title { margin: 0 0 8px; color: var(--muted); font-size: 1rem; font-weight: 800; }
.teacher-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.teacher-link {
  display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand-deep); font-weight: 700; font-size: .95rem; text-decoration: none;
}
.teacher-link:hover { background: #dfe4ff; text-decoration: underline; }
.teacher-link:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---- 좁은 화면 ---- */
@media (max-width: 720px) {
  .hub-top { padding-top: 28px; gap: 12px; }
  .hub-art { width: 112px; }
}
@media (max-width: 480px) {
  body { font-size: 17px; }
  .hub-top { grid-template-columns: 1fr; }
  .hub-art { grid-row: 1; width: 96px; }
  .cards { grid-template-columns: 1fr; }
  .lesson-main { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .lesson, .go, .badge-toggle { transition: none; }
  .lesson:hover, .lesson:hover .go, .badge-toggle:hover:not(:disabled) { transform: none; }
}
