/* 유현T 과학 — 파스텔 테마
   레이아웃: 휴대폰은 위 머리말 + 아래 탭, 900px 이상은 왼쪽 메뉴 + 넓은 본문(두 칸) */
:root {
  --bg: #FAF7F2; --surface: #FFFFFF; --line: #ECE6DD; --line2: #F1ECE4; --seg: #EFEAE2;
  --ink: #2F3437; --muted: #6A6F75;
  --coral: #FCE6DD; --coral-ink: #A84C2A; --coral-deep: #6B3A26; --track: #F6D2C4; --fill: #E39A7D;
  --primary: #F4B49C; --primary-ink: #3A1E12;
  --navy: #E3E8F8; --navy-ink: #34458A;
  --mint: #DDF1E6; --mint-ink: #2A6E4C;
  --lav: #ECE5F7; --lav-ink: #5E4596;
  --butter: #FBF0CF; --butter-ink: #7A5A0E;
  --danger: #B3402A;
  --shadow: 0 1px 2px rgba(47, 52, 55, .04);
  --radius: 20px;
  --font: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1E1D1B; --surface: #2A2826; --line: #3A3733; --line2: #34312D; --seg: #34312D;
    --ink: #ECE8E1; --muted: #A8A39B;
    --coral: #3D2A22; --coral-ink: #F2A98C; --coral-deep: #F2C3AF; --track: #4A3329; --fill: #E39A7D;
    --primary: #E8A68C; --primary-ink: #2A140A;
    --navy: #262C42; --navy-ink: #AEBBEF;
    --mint: #1F3329; --mint-ink: #93D3B0;
    --lav: #2E2740; --lav-ink: #C7B5EE;
    --butter: #3A3220; --butter-ink: #EBCB7A;
    --danger: #F08C76;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1E1D1B; --surface: #2A2826; --line: #3A3733; --line2: #34312D; --seg: #34312D;
  --ink: #ECE8E1; --muted: #A8A39B;
  --coral: #3D2A22; --coral-ink: #F2A98C; --coral-deep: #F2C3AF; --track: #4A3329; --fill: #E39A7D;
  --primary: #E8A68C; --primary-ink: #2A140A;
  --navy: #262C42; --navy-ink: #AEBBEF;
  --mint: #1F3329; --mint-ink: #93D3B0;
  --lav: #2E2740; --lav-ink: #C7B5EE;
  --butter: #3A3220; --butter-ink: #EBCB7A;
  --danger: #F08C76;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55;
  word-break: keep-all; overflow-wrap: break-word; -webkit-tap-highlight-color: transparent;
}
a { color: var(--navy-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--navy-ink); outline-offset: 2px; border-radius: 8px; }

/* ---------- 틀 ---------- */
.layout { min-height: 100dvh; }
.side { display: none; }
.main {
  max-width: 720px; margin: 0 auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; color: inherit; }
.logo { width: 30px; height: 30px; border-radius: 10px; background: var(--coral); color: var(--coral-ink); font-weight: 800; font-size: 15px; display: grid; place-items: center; flex-shrink: 0; }
.who { text-align: right; font-size: 12px; color: var(--muted); line-height: 1.35; }
.who b { color: var(--ink); font-size: 14px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(var(--tabs, 4), minmax(0, 1fr)); gap: 4px;
}
.tabbar a { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 11.5px; font-weight: 500; border-radius: 12px; }
.tabbar a.on { color: var(--coral-ink); font-weight: 700; }
.tabbar svg, .side nav svg { width: 22px; height: 22px; }
.backrow { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.backrow a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
.backrow a:hover { color: var(--ink); }
.backrow .here { color: var(--ink); font-weight: 700; }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--line); padding: 28px 18px;
  }
  .side .brand { margin: 0 8px 22px; font-size: 18px; }
  .side nav { display: flex; flex-direction: column; gap: 4px; }
  .side nav a { text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; color: var(--ink); font-size: 14.5px; }
  .side nav a.on { background: var(--coral); color: var(--coral-ink); font-weight: 700; }
  .side nav a:hover:not(.on) { background: var(--bg); }
  .side .foot { margin-top: auto; padding: 0 8px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; }
  .side .foot b { color: var(--ink); font-size: 14px; }
  .tabbar { display: none; }
  .main { max-width: 1100px; margin: 0; padding: 28px 36px 48px; gap: 18px; }
  .topbar { display: none; }
  .only-m { display: none !important; }
  .cols { display: flex; gap: 18px; align-items: flex-start; }
  .cols > .col-a { flex: 3 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
  .cols > .col-b { flex: 2 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
  .hero-title { font-size: 28px !important; }
}
@media (max-width: 899px) {
  .cols, .cols > .col-a, .cols > .col-b { display: flex; flex-direction: column; gap: 16px; }
  .only-pc { display: none !important; }
}

/* ---------- 카드·목록 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.tight { padding: 2px 16px; }
.tint { border: 0; box-shadow: none; }
.tint.coral { background: var(--coral); } .tint.navy { background: var(--navy); } .tint.mint { background: var(--mint); }
.tint.lav { background: var(--lav); } .tint.butter { background: var(--butter); }
.coral .k, .k.coral { color: var(--coral-ink); } .navy .k { color: var(--navy-ink); } .mint .k { color: var(--mint-ink); }
.lav .k { color: var(--lav-ink); } .butter .k { color: var(--butter-ink); }
.k { font-size: 13px; font-weight: 700; color: var(--muted); }
.big { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.huge { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.sec { display: flex; flex-direction: column; gap: 8px; }
.sec-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.sec-h a, .sec-h button.link { font-weight: 700; }
.row {
  text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; width: 100%;
}
button.row { cursor: pointer; }
a.row:hover, button.row:hover { border-color: var(--primary); }
.row .t { font-weight: 700; font-size: 15px; }
.row .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row > div { min-width: 0; }
.list { display: flex; flex-direction: column; }
.list > .li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line2); text-decoration: none; color: inherit; }
.list > .li:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 3px 10px; white-space: nowrap; background: var(--seg); color: var(--muted); }
.chip.coral { background: var(--coral); color: var(--coral-ink); } .chip.navy { background: var(--navy); color: var(--navy-ink); }
.chip.mint { background: var(--mint); color: var(--mint-ink); } .chip.lav { background: var(--lav); color: var(--lav-ink); }
.chip.butter { background: var(--butter); color: var(--butter-ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--fill); border-radius: 99px; }
.bar.navy { background: var(--line); } .bar.navy > i { background: var(--navy-ink); opacity: .55; }
.bar.mint { background: var(--line); } .bar.mint > i { background: var(--mint-ink); opacity: .6; }

.notice-strip {
  text-decoration: none; color: inherit; background: var(--lav); border-radius: 16px; padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; font-size: 13.5px; border: 0; width: 100%; text-align: left; cursor: pointer;
}
.notice-strip .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-strip svg { color: var(--lav-ink); flex-shrink: 0; width: 18px; height: 18px; }

/* ---------- 버튼·입력 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 11px 16px; font-weight: 700; font-size: 14px;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(.97); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 7px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 0 1 auto; }
.btns.grow > .btn { flex: 1 1 auto; }
button.link { background: none; border: 0; padding: 0; color: var(--navy-ink); cursor: pointer; font-weight: 700; font-size: 13px; }
.iconbtn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 12px; font-size: 15px; min-width: 0;
}
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--coral); }
.input.sm { padding: 7px 9px; font-size: 13.5px; border-radius: 10px; }
.err { color: var(--danger); font-size: 13px; font-weight: 700; }
.form { display: flex; flex-direction: column; gap: 14px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > .input { flex: 1 1 120px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--coral-ink); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--seg); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: 0; border-radius: 11px; padding: 9px 6px; font-size: 14px; font-weight: 500; background: transparent; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 0; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; cursor: pointer; }
.tabs .on { border-bottom-color: var(--coral-ink); color: var(--coral-ink); font-weight: 700; }

/* ---------- 로그인 ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth .brand { justify-content: center; font-size: 20px; }
.auth .logo { width: 40px; height: 40px; border-radius: 13px; font-size: 19px; }
.auth .lead { text-align: center; color: var(--muted); font-size: 14px; }
.pin { letter-spacing: .35em; font-size: 20px; text-align: center; }
.pin::placeholder { letter-spacing: normal; font-size: 15px; }

/* ---------- 숙제 풀이 ---------- */
.q { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 16px; }
.q.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--coral); }
.q-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.q-no { font-weight: 800; font-size: 16px; }
.qimg { border-radius: 12px; border: 1px solid var(--line2); background: #fff; overflow: hidden; }
.qimg img { width: 100%; }
.pad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pad button {
  aspect-ratio: 1 / 1; max-height: 56px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 18px; font-weight: 700; cursor: pointer; color: var(--ink); justify-self: center; width: 100%; max-width: 56px;
}
.pad button.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.confused { border: 1px dashed var(--line); background: transparent; border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.confused.on { background: var(--lav); color: var(--lav-ink); border-color: transparent; }
.submitbar {
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 10; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 10px 10px 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: 0 6px 20px rgba(47, 52, 55, .08);
}
@media (min-width: 900px) { .submitbar { bottom: 16px; } }
.res { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; align-items: start; }
.mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.mark.O { background: var(--mint); color: var(--mint-ink); } .mark.X { background: var(--coral); color: var(--coral-ink); } .mark.P { background: var(--butter); color: var(--butter-ink); }
.kv { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
.kv span b { font-weight: 700; }
.exp { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; }

/* OMR 한 문항씩 */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip button { flex: 0 0 auto; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.strip button.done { background: var(--coral); color: var(--coral-ink); border-color: transparent; }
.strip button.cur { border-color: var(--coral-ink); color: var(--coral-ink); box-shadow: 0 0 0 2px var(--coral); }
.strip .check-tab { padding: 0 12px; }
.pad.big { gap: 10px; padding: 6px 0; }
.pad.big button { max-width: 64px; max-height: 64px; font-size: 21px; }
.review { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.review button { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--ink); min-width: 0; }
.review button .n { font-size: 12px; color: var(--muted); font-weight: 700; }
.review button .a { font-weight: 800; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review button.miss { background: var(--coral); border-color: transparent; }
.review button.miss .a { color: var(--coral-ink); font-size: 13px; }

/* ---------- 자료실 ---------- */
.unit { display: flex; flex-direction: column; gap: 12px; }
.vid { display: flex; flex-direction: column; gap: 8px; }
.vid-btn { display: flex; align-items: center; gap: 10px; background: var(--navy); color: var(--navy-ink); border: 0; border-radius: 14px; padding: 12px 14px; font-weight: 700; cursor: pointer; text-align: left; width: 100%; }
.vid-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.file .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--butter); color: var(--butter-ink); display: grid; place-items: center; flex-shrink: 0; }
.file .ic svg { width: 18px; height: 18px; }

/* ---------- 표·차트 ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line2); text-align: left; white-space: nowrap; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--bg); position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl th.sticky { background: var(--bg); z-index: 2; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding-top: 6px; }
.spark > div { flex: 1; min-width: 6px; border-radius: 6px 6px 3px 3px; background: var(--navy-ink); opacity: .45; position: relative; }
.spark > div.last { opacity: .9; }
.area-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 42px; gap: 10px; align-items: center; font-size: 13.5px; }
.area-row .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- 팝업·알림 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: pop .18s ease-out;
}
@media (min-width: 900px) { .toast { bottom: 28px; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.dim { position: fixed; inset: 0; z-index: 90; background: rgba(20, 18, 16, .45); display: grid; place-items: end center; padding: 0; }
@media (min-width: 640px) { .dim { place-items: center; padding: 24px; } }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet.wide { max-width: 1000px; }
@media (min-width: 640px) { .sheet { border-radius: 22px; padding: 22px; } }
.sheet-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--coral-ink); border-radius: 50%; animation: rot .8s linear infinite; margin: 30px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 30px 0; }
.loading .spin { margin: 0; }

/* ---------- 강사: 문제 사진 자르기 ---------- */
.crop-page { position: relative; margin: 0 auto 16px; border: 1px solid var(--line); background: #fff; touch-action: pan-y; user-select: none; }
.crop-page canvas { display: block; width: 100%; height: auto; }
.cbox { position: absolute; border: 2px solid #E36A44; background: rgba(227, 106, 68, .08); touch-action: none; cursor: move; }
.cbox.sel { border-color: #3B5BDB; background: rgba(59, 91, 219, .1); }
.cbox .tag { position: absolute; left: -2px; top: -22px; background: #E36A44; color: #fff; font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 6px 6px 0 0; }
.cbox.sel .tag { background: #3B5BDB; }
.cbox .hd { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #3B5BDB; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
.thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.qedit { display: grid; grid-template-columns: 34px 96px minmax(0, 1fr) 100px 60px auto; grid-template-areas: "no type ans area pts act"; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.qedit:last-child { border-bottom: 0; }
.qedit .q-no { grid-area: no; } .qedit .q-type { grid-area: type; } .qedit .q-ans { grid-area: ans; }
.qedit .q-area { grid-area: area; } .qedit .q-pts { grid-area: pts; } .qedit .q-act { grid-area: act; }
.qedit .q-more { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .qedit { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 56px auto; grid-template-areas: "no type ans ans ans" "no area area pts act"; }
}
.target { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.target.on { border-color: var(--primary); }

/* 출석 버튼 · 메모 · QR */
.att { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.att button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.att button.on.mint { background: var(--mint); color: var(--mint-ink); border-color: transparent; }
.att button.on.butter { background: var(--butter); color: var(--butter-ink); border-color: transparent; }
.att button.on.coral { background: var(--coral); color: var(--coral-ink); border-color: transparent; }
.att button.on.navy { background: var(--navy); color: var(--navy-ink); border-color: transparent; }
.att button.on.lav { background: var(--lav); color: var(--lav-ink); border-color: transparent; }
@media (max-width: 420px) { .att button { padding: 6px 8px; font-size: 12px; } }
.notebox { text-align: left; width: 100%; border: 1px solid var(--line2); background: var(--bg); border-radius: 14px; padding: 10px 12px; cursor: pointer; color: var(--ink); }
.notebox.pinned { border-color: var(--butter); background: var(--butter); }
.qrbox { background: #fff; padding: 16px; border-radius: 18px; display: inline-block; }
.qrbox img, .qrbox canvas { display: block; width: min(300px, 70vw) !important; height: auto !important; }

/* ===================== 인쇄용 성적표 ===================== */
.print-only { display: none; }
.rc-wrap { min-height: 100vh; background: var(--bg); padding: 16px; }
.rc-bar { max-width: 210mm; margin: 0 auto 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.rc-bar .inline.wrap { flex-wrap: wrap; }
.rc-bar input[type=date] { width: auto; }
.rc-bar select { width: auto; }
.rc-pages { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.rc-page {
  --p-ink: #2F3437; --p-muted: #6A6F75; --p-line: #E6E0D6; --p-soft: #FAF7F2; --p-accent: #E39A7D; --p-accent-ink: #A84C2A; --p-avg: #9AA0A6;
  width: 100%; max-width: 210mm; min-height: 297mm; box-sizing: border-box; padding: 14mm 13mm 12mm;
  background: #fff; color: var(--p-ink); border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.08);
  display: flex; flex-direction: column; gap: 5mm; font-size: 10.5pt; line-height: 1.45;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 4mm; border-bottom: 2px solid var(--p-ink); }
.rc-title { font-size: 21pt; font-weight: 800; letter-spacing: -.02em; }
.rc-sub { font-size: 9.5pt; color: var(--p-muted); }
.rc-who { text-align: right; }
.rc-who .n { font-size: 16pt; font-weight: 800; }
.rc-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3mm; }
.rc-kpi { background: var(--p-soft); border: 1px solid var(--p-line); border-radius: 8px; padding: 3mm 3.5mm; }
.rc-kpi .l { font-size: 9pt; color: var(--p-muted); font-weight: 700; }
.rc-kpi .v { font-size: 17pt; font-weight: 800; color: var(--p-accent-ink); line-height: 1.25; }
.rc-kpi .s { font-size: 8.5pt; color: var(--p-muted); }
.rc-sec { break-inside: avoid; page-break-inside: avoid; }
.rc-sec h3 { font-size: 11pt; font-weight: 800; margin: 0 0 2mm; padding-left: 2.5mm; border-left: 3px solid var(--p-accent); line-height: 1.2; }
.rc-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; align-items: start; }
.rc-tbl { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.rc-tbl th { text-align: left; font-weight: 700; color: var(--p-muted); font-size: 8.5pt; border-bottom: 1px solid var(--p-ink); padding: 1.2mm 1.5mm; }
.rc-tbl td { border-bottom: 1px solid var(--p-line); padding: 1.2mm 1.5mm; }
.rc-tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-tbl td.b { font-weight: 700; }
.rc-miss { color: var(--p-accent-ink); font-weight: 800; }
.rc-empty { color: var(--p-muted); font-size: 9.5pt; margin: 0; }
.rc-small { font-size: 9pt; color: var(--p-muted); margin: 2mm 0 0; }
.rc-chart { width: 100%; height: auto; display: block; }
.rc-chart .grid { stroke: var(--p-line); stroke-width: 1; }
.rc-chart .ax { fill: var(--p-muted); font-size: 10px; }
.rc-chart .val { fill: var(--p-accent-ink); font-size: 10px; font-weight: 700; }
.rc-chart .me { fill: none; stroke: var(--p-accent); stroke-width: 2.5; stroke-linejoin: round; }
.rc-chart .avg { fill: none; stroke: var(--p-avg); stroke-width: 1.5; stroke-dasharray: 4 3; }
.rc-chart .dot { fill: #fff; stroke: var(--p-accent); stroke-width: 2; }
.rc-legend { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: 8.5pt; color: var(--p-muted); margin: -1mm 0 2mm; }
.rc-legend .k { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--p-accent); margin-left: 8px; }
.rc-legend .k.avg { border-top: 1.5px dashed var(--p-avg); }
.rc-att { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2mm; text-align: center; }
.rc-att div { background: var(--p-soft); border: 1px solid var(--p-line); border-radius: 6px; padding: 1.5mm 0; display: flex; flex-direction: column; }
.rc-att b { font-size: 13pt; line-height: 1.2; }
.rc-att span { font-size: 8.5pt; color: var(--p-muted); }
.rc-areas { display: flex; flex-direction: column; gap: 1.8mm; }
.rc-area { display: grid; grid-template-columns: minmax(0, 1fr) 26mm auto; align-items: center; gap: 2mm; font-size: 9pt; }
.rc-area .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-area .bar { height: 2.2mm; background: var(--p-line); border-radius: 2mm; overflow: hidden; }
.rc-area .bar i { display: block; height: 100%; background: #9CC9B0; }
.rc-area.weak .bar i { background: var(--p-accent); }
.rc-area.weak .n { font-weight: 700; color: var(--p-accent-ink); }
.rc-area .p { font-size: 8.5pt; color: var(--p-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-ta { min-height: 70px; font-size: 14px; }
.rc-comment { white-space: pre-wrap; border: 1px solid var(--p-line); background: var(--p-soft); border-radius: 8px; padding: 3mm 4mm; min-height: 18mm; font-size: 10pt; }
.rc-foot { margin-top: auto; display: flex; justify-content: space-between; font-size: 8.5pt; color: var(--p-muted); border-top: 1px solid var(--p-line); padding-top: 2mm; }
@media (max-width: 640px) {
  .rc-wrap { padding: 10px; }
  .rc-page { min-height: 0; padding: 18px 14px; font-size: 13px; }
  .rc-kpis { grid-template-columns: repeat(2, 1fr); }
  .rc-2col { grid-template-columns: 1fr; }
  .rc-head { flex-direction: column; align-items: flex-start; }
  .rc-who { text-align: left; }
}
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .no-print, .toast, .sheet-wrap { display: none !important; }
  .print-only { display: block !important; }
  .rc-cm.empty { display: none; }
  .rc-wrap { padding: 0; background: #fff; min-height: 0; }
  .rc-pages { display: block; }
  .rc-page { max-width: none; width: 210mm; min-height: 296mm; border-radius: 0; box-shadow: none; break-after: page; page-break-after: always; font-size: 10.5pt; padding: 14mm 13mm 12mm; }
  .rc-page:last-child { break-after: auto; page-break-after: auto; }
  .rc-kpis { grid-template-columns: repeat(4, 1fr); }
  .rc-2col { grid-template-columns: 1fr 1fr; }
  .rc-head { flex-direction: row; align-items: flex-end; }
  .rc-who { text-align: right; }
}

/* ===================== 영상 플레이어: 워터마크 · 전체 화면 ===================== */
.wmframe .ythost, .wmframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wmframe .wm {
  position: absolute; z-index: 3; transform: translate(-50%, -50%); pointer-events: none; user-select: none;
  color: rgba(255, 255, 255, .5); text-shadow: 0 0 3px rgba(0, 0, 0, .55); font-weight: 800; letter-spacing: .02em;
  font-size: clamp(12px, 2.4vw, 22px); white-space: nowrap; transition: opacity .6s;
}
.wmframe .fs-exit { display: none; }
.wmframe:fullscreen, .wmframe:-webkit-full-screen { aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0; }
.wmframe:fullscreen .wm { font-size: clamp(16px, 2.2vw, 30px); }
.wmframe.pseudo-fs { position: fixed; inset: 0; z-index: 9999; aspect-ratio: auto; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
.wmframe.pseudo-fs .fs-exit { display: block; position: absolute; z-index: 4; top: max(10px, env(safe-area-inset-top)); left: 10px; font: inherit; font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; border: 0; background: rgba(0, 0, 0, .55); color: #fff; }
body.noscroll { overflow: hidden; }
.vid-btn .tiny.done { color: var(--mint-ink); font-weight: 700; }
.wbar { position: relative; height: 16px; min-width: 90px; background: var(--line2); border-radius: 8px; overflow: hidden; margin-bottom: 2px; }
.wbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--butter); }
.wbar.done i { background: var(--mint); }
.wbar b { position: relative; font-size: 11px; padding-left: 6px; line-height: 16px; }

/* ===================== 풀이 방식: 한 화면 빠른 입력 ===================== */
.solve-seg button { font-size: 13px; padding: 8px 4px; }
.sheet { padding: 4px 12px; }
.srow { padding: 9px 0; border-bottom: 1px solid var(--line2); display: flex; flex-direction: column; gap: 6px; }
.srow:last-child { border-bottom: 0; }
.sline { display: flex; align-items: center; gap: 8px; }
.sno { flex: 0 0 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; font-weight: 800; font-size: 13.5px; background: var(--seg); color: var(--muted); }
.srow.done .sno { background: var(--coral); color: var(--coral-ink); }
.sline > .pad.mini, .sline > .input { flex: 1; min-width: 0; }
.pad.mini { gap: 4px; }
.pad.mini button { max-width: 40px; max-height: 40px; font-size: 15px; border-width: 1.5px; }
.stools { display: flex; gap: 4px; flex: 0 0 auto; }
.peek { display: inline-flex; align-items: center; gap: 3px; height: 32px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.peek.on { background: var(--navy); color: var(--navy-ink); border-color: transparent; }
.peek.q { width: 32px; padding: 0; justify-content: center; font-size: 14px; }
.peek.q.on { background: var(--lav); color: var(--lav-ink); }
.speek { margin-left: 40px; }
@media (max-width: 380px) { .stools .peek:not(.q) svg { display: none; } .pad.mini button { font-size: 14px; } }
