/* 종이 톤: 바탕(desk) 위에 흰 종이(paper) 카드를 올린다.
   색은 따뜻한 무채색 하나로 통일하고, 초록·주황·빨강은 상태 표시에만 쓴다. */
:root {
  --desk: #f4f1eb;
  --paper: #fffefb;
  --sunk: #faf8f4;
  --fill: rgba(21, 19, 15, .045);
  --fill2: rgba(21, 19, 15, .08);
  --line: rgba(21, 19, 15, .09);
  --line2: rgba(21, 19, 15, .16);
  --text: #15130f;
  --sub: #3a362f;
  --muted: #6e6a62;
  --faint: #a39d91;
  --primary: #15130f;
  --mark: rgba(255, 216, 77, .32);
  --ok: #2e6b47;
  --ok-weak: rgba(46, 107, 71, .08);
  --ok-line: rgba(46, 107, 71, .28);
  --warn: #7f5c10;
  --warn-dot: #c9a227;
  --warn-weak: rgba(201, 162, 39, .12);
  --warn-line: rgba(201, 162, 39, .38);
  --bad: #a0412b;
  --bad-weak: rgba(196, 84, 38, .08);
  --bad-line: rgba(196, 84, 38, .3);
  --radius: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(21, 19, 15, .04), 0 4px 16px rgba(21, 19, 15, .04);
  --ease: cubic-bezier(.2, .8, .25, 1);
  --code-font: 16px;
  --left-w: 38%;
  --top-h: 62%;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", Georgia, serif;
  --mono: "JetBrains Mono", "D2Coding", Consolas, monospace;

  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 135, 124, .42) transparent;
}
* { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(140, 135, 124, .42) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140, 135, 124, .34); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(140, 135, 124, .58); border: 3px solid transparent; background-clip: content-box; }
::selection { background: var(--mark); }

body { margin: 0; background: var(--desk); font-size: 15px; line-height: 1.55; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; transition: text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }
[hidden] { display: none !important; }
code, pre, .mono { font-family: var(--mono); }

/* ---------- 움직임 (브라우저에서만 처리, 서버 부담 없음) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(46, 107, 71, .35); } 100% { box-shadow: 0 0 0 10px rgba(46, 107, 71, 0); } }

/* 진행 중 표시용 점 */
.pulse-dot, .run-state.loading::before, .out-muted.running::before, .status-box.pending .status-title::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot);
  margin-right: 8px; vertical-align: 1px; animation: pulse 1.1s ease-in-out infinite;
}
.out-muted.running::before { background: var(--muted); }

/* ---------- 상단 내비 ---------- */
.topnav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 22px; background: rgba(244, 241, 235, .86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav a { text-decoration: none; }
.topnav .brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-right: 14px; color: var(--text); letter-spacing: -0.01em; }
.topnav .brand img { height: 24px; width: auto; }
.topnav .brand .school { font-family: var(--serif); font-weight: 600; letter-spacing: .02em; }
.topnav .brand .sep { width: 1px; height: 14px; background: var(--line2); }
.topnav .brand .sub { color: var(--muted); font-weight: 500; font-size: 14px; }
@media (max-width: 600px) { .topnav .brand .school, .topnav .brand .sep { display: none; } }
.nav-seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--fill); flex-wrap: wrap; }
.topnav a.nav { padding: 5px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; transition: background .15s, color .15s, box-shadow .15s; }
.topnav a.nav:hover { color: var(--text); }
.nav-seg a.nav.active { color: var(--text); font-weight: 600; background: var(--paper); box-shadow: 0 1px 3px rgba(21, 19, 15, .12); }
.topnav .spacer { flex: 1; }
.topnav .who { color: var(--muted); font-size: 14px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 6px;
  background: var(--text); color: var(--paper); font-size: 11px; text-align: center; font-weight: 600; line-height: 18px; }

.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 4px 0 26px; }
.login-brand img { height: 72px; width: auto; }
.login-brand .school { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .02em; color: var(--text); white-space: nowrap; }
.login-brand .eyebrow { margin: 0; }
.ws-emblem { height: 20px; width: auto; }

/* ---------- 공통 ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 30px 22px 70px; animation: rise .32s var(--ease) both; }
h1 { font-family: var(--serif); font-size: 26px; margin: 0 0 18px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.35; }
h2 { font-size: 13px; margin: 36px 0 10px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
h3 { font-size: 15px; margin: 18px 0 8px; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: .08em; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- 버튼 / 폼 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: var(--paper); color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; white-space: nowrap; line-height: 1.3; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s, opacity .15s;
}
.btn:hover { background: var(--sunk); border-color: rgba(21, 19, 15, .24); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--paper); }
.btn-primary:hover { background: #2d2a24; border-color: #2d2a24; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #255a3b; border-color: #255a3b; }
.btn-bad { color: var(--bad); }
.btn-bad:hover { background: var(--bad-weak); border-color: var(--bad-line); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--fill); border-color: transparent; color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-lg { padding: 10px 18px; font-size: 15px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], textarea, select {
  font: inherit; padding: 8px 11px; border: 1px solid var(--line2); border-radius: var(--r-sm); background: var(--paper);
  color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(21, 19, 15, .4); box-shadow: 0 0 0 3px var(--fill2); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 14px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--sub); }
.inline-form { display: inline; }

.alert { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--line); animation: rise .25s var(--ease) both; }
.alert-bad { background: var(--bad-weak); color: var(--bad); border-color: var(--bad-line); }
.alert-ok { background: var(--ok-weak); color: var(--ok); border-color: var(--ok-line); }
.alert-warn { background: var(--warn-weak); color: var(--warn); border-color: var(--warn-line); }
.alert pre { white-space: pre-wrap; margin: 6px 0 0; font-size: 13px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: var(--fill); color: var(--muted); border: 1px solid transparent; }
.badge-pending { color: var(--warn); background: var(--warn-weak); border-color: var(--warn-line); }
.badge-approved, .badge-published { color: var(--ok); background: var(--ok-weak); border-color: var(--ok-line); }
.badge-rejected { color: var(--bad); background: var(--bad-weak); border-color: var(--bad-line); }
.badge-draft { color: var(--muted); }
.lv { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 7px; border: 1px solid var(--line2); color: var(--text); font-weight: 600; font-size: 12px; background: var(--paper);
  font-variant-numeric: tabular-nums; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--paper); }
table.tbl th, table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.tbl th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--sunk); border-bottom-color: var(--line2); }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--sunk); }
table.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }

/* ---------- 단계 진행 막대 (단원 목록·문제 화면 공용) ----------
   done: 통과한 단계(진한 막대) / open: 지금 풀 수 있는 단계 / locked: 잠김 */
.level-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.level-tab { display: inline-flex; flex-direction: column; gap: 5px; min-width: 62px; padding: 6px 9px 5px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.level-tab .bar { display: block; height: 3px; border-radius: 2px; background: var(--line2); position: relative; overflow: hidden; }
.level-tab .bar::after { content: ""; position: absolute; inset: 0; background: var(--text); border-radius: inherit;
  transform: scaleX(0); transform-origin: left; }
.level-tab.done .bar::after { transform: scaleX(1); animation: draw .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
.level-tab.done { color: var(--sub); }
.level-tab:hover { background: var(--fill); color: var(--text); }
.level-tab.current { background: var(--paper); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(21, 19, 15, .12); }
.level-tab.locked { color: var(--faint); cursor: not-allowed; }
.level-tab.locked:hover { background: transparent; color: var(--faint); }
.level-tab.locked .bar { background: var(--line); }
.level-tab.just-unlocked { color: var(--ok); animation: glow 1.2s ease-out 2; }
.level-tab.just-unlocked .bar { background: var(--ok-line); }

/* ---------- 로그인 ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.login-wrap .credit { padding: 22px 0 0; text-align: center; }
.login-card { width: 100%; max-width: 380px; padding: 30px 28px 26px; animation: pop .4s var(--ease) both; }
.login-card h1 { text-align: center; font-size: 20px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ---------- 학생 단원 목록 ---------- */
.unit-list { display: flex; flex-direction: column; gap: 12px; }
.unit-card { display: grid; grid-template-columns: 1fr auto; gap: 14px 20px; align-items: center;
  animation: rise .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.card + .unit-card { margin-top: 0; }
.unit-card .title { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.unit-card .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.unit-card .level-tabs { grid-column: 1 / -1; background: var(--fill); padding: 3px; border-radius: 11px; }
.unit-card .level-tab { flex: 1; }

/* ---------- 문제 풀이 화면 ---------- */
body.workspace { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.ws-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; flex-wrap: wrap; }
.ws-top a.btn { text-decoration: none; }
.ws-top .unit-name { font-family: var(--serif); font-weight: 600; font-size: 15px; margin-right: 6px; }
.ws-top .level-tabs { background: var(--fill); padding: 3px; border-radius: 11px; }
.ws-top .spacer { flex: 1; }
.ws-top .badge { animation: fade .3s both; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--fill); }
.seg .btn { border-color: transparent; background: transparent; padding: 3px 9px; font-size: 13px; color: var(--muted); }
.seg .btn:hover { background: var(--paper); color: var(--text); }

.ws-main { flex: 1; display: flex; min-height: 0; padding: 0 12px 12px; }
.ws-left, .ws-right { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: rise .35s var(--ease) both; }
.ws-right { animation-delay: 60ms; }
.ws-left { width: var(--left-w); min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.ws-left-inner { flex: 1; overflow-y: auto; padding: 26px 30px 36px; }
body.left-collapsed .ws-left, body.left-collapsed #split-v { display: none; }
.ws-right { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* 분할선: 평소엔 여백처럼 보이고, 마우스를 올리면 손잡이가 나타난다 */
.splitter-v { width: 12px; cursor: col-resize; flex-shrink: 0; position: relative; }
.splitter-v::after { content: ""; position: absolute; top: 50%; left: 5px; width: 2px; height: 36px; margin-top: -18px;
  border-radius: 2px; background: var(--line2); opacity: 0; transition: opacity .15s, height .2s var(--ease), margin .2s var(--ease); }
.splitter-v:hover::after, body.dragging .splitter-v::after { opacity: 1; height: 64px; margin-top: -32px; }
.splitter-h { height: 1px; background: var(--line); cursor: row-resize; flex-shrink: 0; position: relative; transition: background .15s; }
.splitter-h::before { content: ""; position: absolute; inset: -5px 0; }
.splitter-h:hover, body.dragging .splitter-h { background: var(--line2); }
body.dragging { user-select: none; }

.ws-editor { height: var(--top-h); min-height: 80px; display: flex; flex-direction: column; }
#editor { flex: 1; min-height: 0; }
#editor .CodeMirror { height: 100%; font-size: var(--code-font); line-height: 1.6; font-family: var(--mono); background: var(--paper); color: var(--text); }
.CodeMirror-gutters { background: var(--paper) !important; border-right: 0 !important; }
.CodeMirror-linenumber { color: var(--faint) !important; padding: 0 12px 0 8px !important; }
.CodeMirror-lines { padding: 14px 0 !important; }
.CodeMirror-cursor { border-left: 2px solid var(--text) !important; }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--mark) !important; }
.CodeMirror-activeline-background { background: rgba(21, 19, 15, .03) !important; }
.cm-indent-guide { box-shadow: inset 1px 0 0 rgba(120, 112, 100, .25); }
.cm-error-line { background: rgba(196, 84, 38, .12) !important; transition: background .3s; }

.ws-toolbar { display: flex; gap: 6px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ws-toolbar .spacer { flex: 1; }
.run-state { font-size: 12px; color: var(--muted); margin-left: 4px; animation: fade .3s both; }
.run-state.ready { color: var(--faint); }
.run-state.error { color: var(--bad); }
.kbd { font-size: 11px; opacity: .6; font-weight: 400; }
#save-state { transition: opacity .3s; }

/* 실행 결과 / 입력값: 한 번에 하나만 보이는 탭 */
.ws-io { flex: 1; min-height: 80px; display: flex; flex-direction: column; }
.io-tabs { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; }
.io-tabs .seg button { border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--muted); padding: 4px 12px;
  border-radius: 7px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.io-tabs .seg button:hover { color: var(--text); }
.io-tabs .seg button.active { background: var(--paper); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(21, 19, 15, .12); }
.io-tabs .stdin-count { font-weight: 400; color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.io-pane { display: none; flex: 1; min-height: 0; flex-direction: column; }
.io-pane.active { display: flex; animation: fade .18s both; }
.io-note { font-size: 12px; color: var(--faint); padding: 8px 14px 0; }
#stdin { flex: 1; border: 0; border-radius: 0; resize: none; font-family: var(--mono); font-size: calc(var(--code-font) - 2px);
  padding: 8px 14px 12px; background: transparent; box-shadow: none; }
#stdin:focus { box-shadow: none; }
#output { flex: 1; overflow: auto; padding: 10px 16px 14px; font-size: calc(var(--code-font) - 2px); }
#output > * { animation: rise .22s var(--ease) both; }
#output > *:nth-child(2) { animation-delay: 40ms; }
#output > *:nth-child(3) { animation-delay: 80ms; }
#output > *:nth-child(n+4) { animation-delay: 110ms; }
.out-text { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; font-size: inherit; }
.out-muted { color: var(--muted); }
.out-ok { color: var(--ok); font-size: 13px; }
.out-error { border-left: 3px solid var(--bad); background: var(--bad-weak); color: var(--bad); padding: 9px 13px; margin: 6px 0; border-radius: 0 8px 8px 0; }
.out-hint { color: var(--text); margin-top: 4px; font-size: 14px; }
.test-summary { font-weight: 600; margin-bottom: 8px; }
.test-summary.pass { color: var(--ok); }
.test-summary.fail { color: var(--bad); }
.test-case { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; padding: 6px 12px; }
.test-case summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.test-case.pass summary { color: var(--ok); }
.test-case.fail summary { color: var(--bad); }
.test-case[open] .test-grid { animation: rise .2s var(--ease) both; }
.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 6px; }
.test-grid pre { margin: 0; background: var(--sunk); border: 1px solid var(--line); padding: 7px 9px; border-radius: 8px; white-space: pre-wrap; min-height: 30px; font-size: 13px; }
.lbl { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* 문제 설명: 교과서 지면처럼 */
.prob-head { margin-bottom: 14px; }
.prob-title { font-family: var(--serif); font-size: 23px; font-weight: 600; margin: 0; line-height: 1.4; }
.siblings { display: flex; gap: 2px; margin-bottom: 16px; flex-wrap: wrap; padding: 3px; background: var(--fill); border-radius: 10px; width: fit-content; }
.siblings .btn { border-color: transparent; background: transparent; color: var(--muted); }
.siblings .btn.btn-primary { background: var(--paper); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(21, 19, 15, .12); }
.md { font-size: 15.5px; line-height: 1.85; color: var(--sub); }
.md p { margin: 0 0 12px; }
.md strong { color: var(--text); }
.md code { background: var(--fill); padding: 1px 6px; border-radius: 5px; font-size: .9em; color: var(--text); }
.md pre { background: var(--sunk); border: 1px solid var(--line); padding: 11px 14px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--line); padding: 4px 9px; }
.example { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.example h4, .hint-box summary { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: .08em; }
.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.example-grid pre { margin: 0; background: var(--sunk); border: 1px solid var(--line); padding: 9px 12px; border-radius: 10px; min-height: 40px; white-space: pre-wrap; font-size: 14px; }
.example-grid .lbl { display: flex; justify-content: space-between; align-items: center; min-height: 26px; }
.hint-box { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.hint-box summary { cursor: pointer; margin: 0; list-style: none; transition: color .15s; }
.hint-box summary::-webkit-details-marker { display: none; }
.hint-box summary::after { content: "  +"; }
.hint-box[open] summary::after { content: "  −"; }
.hint-box summary:hover { color: var(--text); }
.hint-box[open] .md { margin-top: 8px; animation: rise .22s var(--ease) both; }
.status-box { margin-top: 22px; padding: 12px 16px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 0 10px 10px 0; background: var(--sunk);
  animation: rise .3s var(--ease) both; }
.status-box.pending { border-left-color: var(--warn-dot); }
.status-box.approved { border-left-color: var(--ok); }
.status-box.rejected { border-left-color: var(--bad); }
.status-title { font-weight: 600; font-size: 14px; }
.status-feedback { margin-top: 6px; white-space: pre-wrap; }
.btn-next { margin-top: 12px; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; background: var(--text); color: var(--paper); padding: 13px 18px;
  border-radius: 12px; box-shadow: 0 12px 40px rgba(21, 19, 15, .25); font-size: 14px; animation: pop .35s var(--ease) both; }
.toast a { color: var(--paper); text-decoration: underline; font-weight: 600; margin-left: 8px; }
.modal { position: fixed; inset: 0; background: rgba(21, 19, 15, .3); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px;
  animation: fade .18s both; }
.modal-card { background: rgba(255, 254, 251, .92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line2); border-radius: 16px; padding: 22px 24px; max-width: 420px; width: 100%;
  box-shadow: 0 26px 70px rgba(21, 19, 15, .25); animation: pop .25s var(--ease) both; }
.modal-msg { margin-bottom: 18px; font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 860px) {
  body.workspace { height: auto; overflow: auto; }
  .ws-main { flex-direction: column; gap: 10px; padding: 0 10px 10px; }
  .ws-left { width: 100%; max-height: 45vh; }
  .ws-left-inner { padding: 20px 20px 26px; }
  body.left-collapsed .ws-left { display: flex; }
  .splitter-v, .splitter-h, #toggle-left { display: none; }
  .ws-editor { height: 55vh; }
  .ws-io { min-height: 40vh; }
  .io-pane { min-height: 35vh; }
  .test-grid, .example-grid { grid-template-columns: 1fr; }
}

/* ---------- 교사: 승인 대기함 ---------- */
.queue-item { display: grid; grid-template-columns: 260px 1fr; gap: 18px; animation: rise .3s var(--ease) both; }
.queue-item + .queue-item { margin-top: 12px; }
.queue-item .meta .name { font-weight: 600; font-size: 15px; }
.queue-item pre.code { margin: 0; max-height: 340px; overflow: auto; background: var(--sunk); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px; font-size: 14px; line-height: 1.6; }
.queue-item .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.queue-item .fb { margin-top: 8px; animation: rise .2s var(--ease) both; }
.auto-pass { color: var(--ok); font-weight: 500; }
.auto-fail { color: var(--bad); font-weight: 500; }
.blocked-flag { color: var(--bad); background: var(--bad-weak); border: 1px solid var(--bad-line); padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }
@media (max-width: 820px) { .queue-item { grid-template-columns: 1fr; } }
.cm-static .CodeMirror { height: auto; max-height: 360px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: var(--paper); }

/* 대시보드 격자 */
.grid-cell { display: inline-flex; align-items: center; gap: 5px; }
.pend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); display: inline-block; }
td .pend-dot { animation: pulse 1.6s ease-in-out infinite; }

/* 개념 체크박스 */
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.concept-grid label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 6px 8px; border-radius: 8px; transition: background .12s; }
.concept-grid label:hover { background: var(--fill); }
.concept-grid label.inherited { color: var(--muted); }
.concept-grid .desc { display: block; font-size: 12px; color: var(--muted); }
input[type=checkbox] { accent-color: var(--text); }

.level-block { border-top: 1px solid var(--line); padding: 14px 0 8px; }
.prob-row { display: flex; gap: 10px; align-items: center; padding: 7px 8px; margin: 0 -8px; flex-wrap: wrap; border-radius: 8px; transition: background .12s; }
.prob-row:hover { background: var(--fill); }
.prob-row .t { flex: 1; min-width: 180px; }

.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: var(--mono); font-size: 13px; }
ol.steps li { margin-bottom: 10px; }

/* 반 탭 */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 3px; margin-bottom: 12px; background: var(--fill); border-radius: 11px; width: fit-content; max-width: 100%; }
.tab { padding: 5px 12px; color: var(--muted); font-size: 14px; border-radius: 8px; text-decoration: none; transition: background .15s, color .15s, box-shadow .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; background: var(--paper); box-shadow: 0 1px 3px rgba(21, 19, 15, .12); }
button.tab { background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; }
button.tab.active { background: var(--paper); }

/* 단계 분포 막대 (진할수록 높은 단계) */
.dist { display: flex; height: 6px; margin-top: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; min-width: 120px; }
.dist-seg { display: block; height: 100%; transform-origin: left; animation: draw .6s var(--ease) both; }
.dist-seg.d0 { background: #e6e1d6; } .dist-seg.d1 { background: #d3cdbf; } .dist-seg.d2 { background: #aea796; }
.dist-seg.d3 { background: #847d6f; } .dist-seg.d4 { background: #4d4840; } .dist-seg.d5 { background: #15130f; }
.class-input { width: 80px !important; padding: 4px 7px !important; font-size: 13px; }

/* ---------- 만든 사람 (옅게 두고, 이름에 마우스를 올리면 형광펜이 그어진다) ---------- */
.credit { max-width: 1180px; margin: 0 auto; padding: 0 22px 34px; font-size: 12px; color: var(--faint); letter-spacing: .01em; }
.credit .c-part { display: inline-block; white-space: nowrap; }
.credit .c-part + .c-part::before { content: "·"; margin: 0 8px; }
.who-made { color: var(--muted); white-space: nowrap; padding: 0 2px; cursor: default;
  background: linear-gradient(var(--mark), var(--mark)) no-repeat 0 90% / 0% 50%;
  transition: background-size .45s var(--ease), color .2s; }
.who-made b { font-family: var(--serif); font-weight: 600; color: var(--sub); margin-right: 3px; }
.who-made:hover { background-size: 100% 50%; color: var(--text); }
.ws-left-inner { display: flex; flex-direction: column; }
.ws-left-inner .credit { margin: auto 0 0; padding: 40px 0 0; max-width: none; }

/* 폭죽 캔버스 */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
