:root {
  --navy: #1B2A41; --blue: #2F6FE4; --blue-soft: #E8F0FD; --red: #E53935; --green: #1E9E61; --green-soft: #E5F6EE;
  --yellow: #F2B705; --yellow-soft: #FFF6D9; --gray: #5B6B7B; --line: #E3E7EC; --bg: #F5F7FA; --card: #FFFFFF;
  --apply: #7B5CD6; --add: #2F6FE4; --ext: #E0663A;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--navy); font-family: Pretendard, 'Malgun Gothic', sans-serif; word-break: keep-all; }
button { font: inherit; color: inherit; cursor: pointer; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #4F8BFF, #2F6FE4); box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }
.chip { border: 0; background: rgba(255,255,255,.15); color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
.muted { color: var(--gray); }
.small { font-size: 14px; }
.center { margin: 40px auto; text-align: center; }
.card-box { background: var(--card); border-radius: 18px; padding: 32px 24px; box-shadow: 0 2px 12px rgba(27,42,65,.08); max-width: 420px; }
.card-box.wide { max-width: 640px; }
.card-box h1 { margin: 0 0 6px; font-size: 26px; }
form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
input { font: inherit; font-size: 24px; text-align: center; letter-spacing: 4px; padding: 12px; border: 2px solid var(--line); border-radius: 12px; }
input:focus { outline: none; border-color: var(--blue); }
.err { color: var(--red); min-height: 1.4em; font-weight: 700; }
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.ok { background: var(--green); color: #fff; }
.btn.soft { background: var(--yellow-soft); color: #7A5A00; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--gray); }
.btn.big { font-size: 22px; padding: 16px 26px; }
.btn.small { font-size: 14px; padding: 8px 12px; }
.nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 18px; }
.nb { border: 0; background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: 20px; padding: 14px 0; border-radius: 12px; }
.nb:active { background: var(--blue); color: #fff; }
.lessons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.closed { color: var(--gray); font-weight: 700; font-size: 18px; }
.closed .ic { width: 44px; height: 44px; color: #B7C0CB; }

/* 학생: 카드 목록 */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lead { margin: 4px 0; font-weight: 700; }
.count { background: var(--green-soft); color: var(--green); font-weight: 800; border-radius: 999px; padding: 6px 14px; }
h2.g { display: flex; align-items: baseline; gap: 10px; font-size: 20px; margin: 26px 0 10px; }
h2.g small { font-size: 14px; color: var(--gray); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile { position: relative; text-align: left; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px 14px 38px; min-height: 108px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 4px rgba(27,42,65,.05); }
.tile:hover { border-color: var(--blue); }
.tile.done { background: var(--green-soft); border-color: #BFE6D1; }
.tag { display: inline-block; font-size: 13px; font-weight: 800; color: #fff; border-radius: 6px; padding: 2px 8px; align-self: flex-start; }
.t-응용 { background: var(--apply); } .t-추가 { background: var(--add); } .t-확장 { background: var(--ext); }
.hd { font-weight: 700; font-size: 17px; line-height: 1.4; }
.blk { color: var(--blue); font-weight: 700; }
.st { position: absolute; left: 14px; bottom: 10px; font-size: 13px; font-weight: 800; border-radius: 999px; padding: 2px 10px; display: inline-flex; align-items: center; gap: 3px; }
.st1 { background: #EEF1F5; color: var(--gray); } .st2 { background: var(--yellow-soft); color: #7A5A00; }
.st3 { background: var(--blue-soft); color: var(--blue); } .st4 { background: var(--green); color: #fff; }

/* 학생: 카드 한 장 */
.back { border: 0; background: none; color: var(--gray); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; padding: 6px 0; margin-bottom: 8px; }
.detail { background: var(--card); border-radius: 18px; padding: 24px; box-shadow: 0 2px 12px rgba(27,42,65,.08); display: flex; flex-direction: column; gap: 14px; }
.detail h1 { margin: 0; font-size: 24px; line-height: 1.35; }
.spec { margin: 0; padding-left: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.spec li { counter-increment: s; position: relative; padding-left: 38px; font-size: 18px; line-height: 1.5; }
.spec li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.rows { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 0; font-size: 18px; line-height: 1.5; }
.rows dt { font-weight: 800; color: var(--apply); }
.rows dd { margin: 0; }
.warn { color: var(--red); font-weight: 700; margin: 0; }
.hint { background: var(--yellow-soft); border-radius: 12px; padding: 14px 16px; }
.hint > b { color: #7A5A00; display: flex; align-items: center; gap: 6px; }
.hint p { margin: 6px 0 0; font-size: 17px; line-height: 1.5; }
.answer { border: 2px solid var(--blue-soft); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.answer > b { color: var(--blue); display: flex; align-items: center; gap: 6px; }
.answer figure { margin: 0; overflow-x: auto; }
.answer figcaption { font-weight: 700; color: var(--gray); font-size: 14px; margin-bottom: 4px; }
.answer img { max-width: 100%; height: auto; display: block; }
.donebar { background: var(--green-soft); color: var(--green); font-weight: 800; border-radius: 12px; padding: 12px; text-align: center; margin: 0; }
.detail .btn { align-self: flex-start; }

.modal { position: fixed; inset: 0; background: rgba(27,42,65,.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.sheet { background: #fff; border-radius: 18px; padding: 24px; max-width: 420px; width: 100%; }
.sheet .q { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.sheet .sub { color: var(--gray); margin: 0 0 18px; }
.sheet .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* 교사 */
.teacher main { max-width: 1280px; }
.live { font-size: 13px; font-weight: 800; border-radius: 999px; padding: 4px 12px; }
.live.on { background: var(--green); } .live.off { background: #8A97A6; }
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; max-width: 1280px; margin: 0 auto; overflow-x: auto; }
.tab { position: relative; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 16px; display: flex; flex-direction: column; align-items: flex-start; min-width: 104px; }
.tab span { font-weight: 800; } .tab small { color: var(--gray); font-size: 12px; }
.tab.on { border-color: var(--blue); background: var(--blue-soft); }
.tab .dot { position: absolute; right: 8px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.ctl { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: #fff; border-radius: 16px; padding: 16px 20px; }
.ctl h1 { margin: 0 0 4px; font-size: 24px; }
.ctl p { margin: 0; }
.sw-wrap { display: flex; align-items: center; gap: 12px; }
.swl { font-weight: 800; }
.switch { width: 74px; height: 40px; border-radius: 999px; border: 0; background: #C9D1DB; position: relative; transition: background .2s; }
.switch i { position: absolute; top: 4px; left: 4px; width: 32px; height: 32px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--green); } .switch.on i { left: 38px; }
.sum { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 14px 4px; }
.sum b { font-size: 22px; }
.lg { display: inline-flex; align-items: center; gap: 6px; color: var(--gray); font-size: 14px; flex-wrap: wrap; }
.lg i { display: inline-flex; width: 22px; height: 22px; border-radius: 6px; align-items: center; justify-content: center; margin-left: 6px; }
.sum .btn { margin-left: auto; }
.empty { background: #fff; border-radius: 16px; padding: 40px; text-align: center; color: var(--gray); font-weight: 700; }
.tbl-wrap { overflow-x: auto; background: #fff; border-radius: 16px; padding: 8px; }
.tbl { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 14px; }
.tbl th { font-weight: 800; color: var(--gray); padding: 6px 4px; white-space: nowrap; }
.tbl tbody th { color: var(--navy); font-size: 16px; }
.tbl td { text-align: center; height: 34px; border-radius: 8px; background: #F3F5F8; }
.tbl td.c .ic { width: 18px; height: 18px; }
.s1, td.s1 { background: #E4E8EE !important; color: #8A97A6; }
.s2, td.s2 { background: var(--yellow-soft) !important; color: #B08400; }
.s3, td.s3 { background: var(--blue-soft) !important; color: var(--blue); }
.s4, td.s4 { background: var(--green) !important; color: #fff; }
.tbl td.tot { background: none; font-weight: 800; font-size: 16px; }
.tbl td.ago { background: none; color: var(--gray); white-space: nowrap; }
.tbl tfoot td { background: none; font-weight: 800; color: var(--gray); }
.cardlist { margin-top: 16px; background: #fff; border-radius: 16px; padding: 12px 18px; }
.cardlist summary { font-weight: 800; cursor: pointer; }
.cardlist li { margin: 6px 0; }

@media (max-width: 560px) {
  .nums { grid-template-columns: repeat(5, 1fr); }
  .detail { padding: 18px; }
  .spec li, .rows, .hint p { font-size: 16px; }
}
