/* 에디코딩 LMS — 남색 #1f3a5f + 주황 포인트 #ff8a3d */
:root {
  --navy: #1f3a5f; --navy-2: #2b4c77; --navy-soft: #e8eef6;
  --orange: #ff8a3d; --orange-soft: #fff1e7;
  --ink: #1c2430; --muted: #6b7686; --line: #e3e7ee; --bg: #f5f7fa; --card: #fff;
  --ok: #1f9d55; --ok-soft: #e5f6ec; --bad: #d64545; --bad-soft: #fdeaea; --wait: #b7791f; --wait-soft: #fdf4e3;
  --bronze: #ad6a3b; --silver: #7d8a99; --gold: #d4a017; --platinum: #2aa198; --diamond: #3b82f6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, textarea.code { font-family: "D2Coding", "JetBrains Mono", Consolas, monospace; }

/* 상단 바 */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 28px;
  padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 800; font-size: 18px; color: #fff; letter-spacing: -0.3px; }
.brand span { color: var(--orange); }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { color: #c9d6e8; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.topnav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.topnav a.on { color: #fff; background: var(--navy-2); box-shadow: inset 0 -3px 0 var(--orange); }
.whoami { display: flex; align-items: center; gap: 12px; color: #c9d6e8; font-size: 14px; }
.whoami form { margin: 0; }
.linkbtn { background: none; border: 1px solid #4a6a93; color: #dbe5f1; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.linkbtn:hover { background: var(--navy-2); }

.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page.wide { max-width: none; }
h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: -0.4px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.row { display: flex; gap: 16px; align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }

/* 버튼·폼 */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #c5ccd8; text-decoration: none; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: #f27a2b; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: wait; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=datetime-local],
select, textarea { font: inherit; border: 1px solid #cfd6e1; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffc49c; border-color: var(--orange); }
label { font-weight: 600; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field textarea { min-height: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.inline { display: inline; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.error { background: var(--bad-soft); color: #9b2c2c; }
.alert.ok { background: var(--ok-soft); color: #22543d; }
.alert.warn { background: var(--wait-soft); color: #7b4a0e; }
.alert.big { font-size: 17px; font-weight: 700; }

/* 표 (CodeUp 형) */
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
table.list th { background: var(--navy-soft); color: var(--navy); text-align: left; font-size: 13px;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafbfd; }
td.num, th.num { width: 72px; color: var(--muted); font-variant-numeric: tabular-nums; }
td.state, th.state { width: 64px; text-align: center; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--navy-soft);
  color: var(--navy); margin-right: 4px; white-space: nowrap; }
.unit-tag { color: var(--navy-2); font-weight: 600; margin-right: 4px; }
.explain { color: var(--orange); font-size: 13px; font-weight: 700; }

/* 문제집 레이아웃 */
.sets { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.setlist { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.setlist h3 { margin: 0; padding: 12px 14px; background: var(--navy); color: #fff; font-size: 14px; }
.setlist a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.setlist a.on { background: var(--orange-soft); color: #b4501a; font-weight: 700; border-left: 4px solid var(--orange); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: #fff; font-size: 13px; color: var(--ink); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip:hover { text-decoration: none; border-color: var(--navy-2); }
.bar { height: 10px; background: #e6eaf0; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #ffb070); }
.bar.navy > i { background: linear-gradient(90deg, var(--navy-2), #5b84b8); }

/* 프로필 배너 */
.profile { display: flex; gap: 22px; align-items: center; background: linear-gradient(120deg, var(--navy), var(--navy-2));
  color: #fff; border-radius: 14px; padding: 20px 24px; margin-bottom: 20px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--orange); display: grid; place-items: center;
  font-size: 26px; font-weight: 800; flex: none; }
.profile .name { font-size: 20px; font-weight: 800; }
.tier { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  background: #fff; color: var(--navy); letter-spacing: .5px; margin-left: 8px; vertical-align: middle; }
.tier.bronze { color: var(--bronze); } .tier.silver { color: var(--silver); } .tier.gold { color: var(--gold); }
.tier.platinum { color: var(--platinum); } .tier.diamond { color: var(--diamond); }
.profile .bar { background: rgba(255,255,255,.2); margin: 6px 0 2px; max-width: 360px; }
.pstats { display: flex; gap: 20px; }
.pstats div { text-align: center; }
.pstats b { display: block; font-size: 20px; }
.pstats span { font-size: 12px; color: #c9d6e8; }
.grass { display: flex; gap: 4px; align-items: flex-end; }
.grass i { width: 18px; height: 18px; border-radius: 4px; background: rgba(255,255,255,.15); display: block; }
.grass i.l1 { background: #ffd3b3; } .grass i.l2 { background: #ffab70; } .grass i.l3 { background: var(--orange); }

.diff { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.diff.bronze { background: var(--bronze); } .diff.silver { background: var(--silver); } .diff.gold { background: var(--gold); }
.diff.platinum { background: var(--platinum); } .diff.diamond { background: var(--diamond); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bulk-bar { position: sticky; top: 0; z-index: 4; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.pager { display: flex; gap: 4px; justify-content: center; margin: 16px 0; }
.pager a, .pager span { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.pager span.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* 진도 */
.lesson { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lesson:last-child { border-bottom: 0; }
.lesson.current { background: var(--orange-soft); border-left: 4px solid var(--orange); }
.badge { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.in_progress { background: var(--wait-soft); color: var(--wait); }
.badge.needs_review { background: var(--bad-soft); color: var(--bad); }
.badge.not_started { background: #eef1f5; color: var(--muted); }

/* 풀이 화면 */
body.solve-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.solve { flex: 1; display: grid; grid-template-columns: minmax(340px, 44%) 1fr; min-height: 0; }
.problem { overflow: auto; padding: 22px 26px; background: #fff; border-right: 1px solid var(--line); }
.problem h1 { font-size: 21px; margin-bottom: 6px; }
.limits { border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.limits td, .limits th { border: 1px solid var(--line); padding: 5px 12px; }
.limits th { background: var(--navy-soft); color: var(--navy); }
.psec h3 { color: var(--navy); border-left: 4px solid var(--orange); padding-left: 8px; }
.hint { background: #fffaf3; border: 1px solid #ffe0c4; border-radius: 8px; padding: 10px 14px; }
pre.sample { background: #f3f5f8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; margin: 4px 0 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 0; }
.tabs button { background: none; border: 0; padding: 8px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--orange); }
.tabs button[disabled] { cursor: not-allowed; }
.problem img { max-width: 100%; border-radius: 8px; }
.ide { display: flex; flex-direction: column; min-height: 0; background: #1e1f22; color: #d4d7dd; }
.ide-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #17181a; border-bottom: 1px solid #2c2e33; }
.filetab { background: #26282c; color: #fff; padding: 5px 12px; border-radius: 6px 6px 0 0; font-size: 13px; font-family: Consolas, monospace; }
.ide-head select, .ide-head .btn { background: #2c2e33; color: #d4d7dd; border-color: #3a3d44; }
.ide-head .btn:hover { border-color: #555; }
.editor-wrap { flex: 1; min-height: 0; position: relative; }
.editor-wrap .CodeMirror, .editor-wrap textarea.code { position: absolute; inset: 0; height: 100%; width: 100%; font-size: 15px; }
.editor-wrap textarea.code { background: #212226; color: #e6e6e6; border: 0; border-radius: 0; padding: 12px; resize: none; tab-size: 4; }
.console { height: 45%; min-height: 280px; display: flex; flex-direction: column; border-top: 1px solid #2c2e33; }
.console .tabs { border-color: #2c2e33; margin: 0; padding: 0 8px; background: #17181a; }
.console .tabs button { color: #8b9099; }
.console .tabs button.on { color: #fff; }
.console-body { flex: 1; min-height: 90px; overflow: auto; padding: 10px 14px; font-family: Consolas, monospace; font-size: 13.5px; white-space: pre-wrap; }
.stdin-row { display: flex; gap: 8px; padding: 8px 10px; background: #17181a; border-top: 1px solid #2c2e33; align-items: flex-end; }
.stdin-row textarea { flex: 1; background: #26282c; color: #e6e6e6; border-color: #3a3d44; min-height: 38px; height: 38px; font-family: Consolas, monospace; }
.v-PASS, .v-OK { color: #5fd38d; } .v-WRONG, .v-RUNTIME_ERROR, .v-COMPILE_ERROR { color: #ff7b7b; }
.v-TIMEOUT, .v-OUTPUT_LIMIT { color: #f3c969; }
.case { border: 1px solid #33363c; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.case pre { margin: 4px 0; background: #26282c; padding: 6px 8px; border-radius: 6px; white-space: pre-wrap; }
.score-big { font-size: 20px; font-weight: 800; }
.upload-box { padding: 28px; color: var(--ink); background: #fff; flex: 1; overflow: auto; }
/* 스크래치(블록 코딩) 풀이 화면 — 편집기를 넓게 */
.solve.scratch-solve { grid-template-columns: minmax(260px, 24%) 1fr; }
.scratch-panel { display: flex; flex-direction: column; min-height: 0; background: #1e1f22; color: #d4d7dd; }
.scratch-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #17181a; border-bottom: 1px solid #2c2e33; }
.scratch-bar .btn:not(.primary) { background: #2c2e33; color: #d4d7dd; border-color: #3a3d44; }
.scratch-bar .muted { color: #9aa0a8; }
.scratch-editor { flex: 1; min-height: 480px; width: 100%; border: 0; background: #fff; }
.scratch-console { height: auto; max-height: 32%; min-height: 96px; }
.scratch-console .console-body { min-height: 60px; }
.scratch-solve .limits { font-size: 12px; }
.scratch-solve .limits td, .scratch-solve .limits th { padding: 4px 6px; white-space: nowrap; }
.scratch-panel:not(:has(.scratch-editor)) .scratch-console { height: auto; flex: 1; }
.sb3-upload { padding: 6px 14px 10px; border-top: 1px solid #2c2e33; font-size: 13px; }
.sb3-upload summary { cursor: pointer; color: #aeb4bd; }
.sb3-upload input[type=file] { color: #d4d7dd; margin: 6px 8px 0 0; }

/* 강사 */
.t-nav a.on { box-shadow: inset 0 -3px 0 var(--orange); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { font-size: 26px; color: var(--navy); display: block; }
table.matrix { border-collapse: collapse; background: #fff; font-size: 13px; }
table.matrix th, table.matrix td { border: 1px solid var(--line); padding: 0; text-align: center; }
table.matrix th { background: var(--navy-soft); color: var(--navy); padding: 6px 8px; font-weight: 600; max-width: 120px; }
table.matrix td.who { text-align: left; padding: 6px 10px; white-space: nowrap; font-weight: 600; }
.cell { position: relative; }
.cell summary { list-style: none; cursor: pointer; width: 100%; min-width: 64px; height: 34px; display: grid; place-items: center; font-size: 15px; }
.cell summary::-webkit-details-marker { display: none; }
.cell.done summary { background: #c9efd7; } .cell.in_progress summary { background: #fde7bf; }
.cell.needs_review summary { background: #f9cccc; } .cell.not_started summary { background: #fafbfc; }
.cell .teacher-mark { position: absolute; top: 2px; right: 4px; font-size: 9px; color: var(--navy); }
.cell .menu { position: absolute; z-index: 50; top: 34px; left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.cell .menu button { text-align: left; }
.cell .menu b { white-space: nowrap; }
/* 스크립트가 켜지면(matrix.html) 메뉴를 화면 기준으로 띄워 표의 스크롤 영역에 잘리지 않게 한다. 위치는 스크립트가 정한다 */
table.matrix.js-menus .cell .menu { position: fixed; }
.code-view { background: #1e1f22; color: #e6e6e6; padding: 14px; border-radius: 8px; overflow: auto; white-space: pre; font-size: 13.5px; }
.pin-once { font-size: 34px; letter-spacing: 8px; font-weight: 800; color: var(--navy); }
.login-wrap { max-width: 380px; margin: 60px auto; }
.login-wrap .card { padding: 28px; }
.login-wrap h1 { text-align: center; }
.login-wrap input { width: 100%; font-size: 18px; }
.login-wrap .btn { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.danger-zone { border-color: #f3c6c6; }
@media (max-width: 860px) {
  .sets { grid-template-columns: 1fr; }
  .solve { grid-template-columns: 1fr; overflow: auto; }
  body.solve-page { height: auto; overflow: auto; }
  .ide { min-height: 80vh; }
  .scratch-editor { min-height: 640px; }
  .profile { flex-wrap: wrap; }
}

.stdin-box { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.stdin-label { color: #aeb4bd; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stdin-label .btn { padding: 1px 8px; font-size: 12px; }
.stdin-row textarea.need-input { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255, 138, 61, .45); }

/* 제출 결과 칸: 템플릿 줄바꿈이 빈 줄로 보이지 않게 (결과 내용만 줄바꿈 유지) */
#result { white-space: normal; }
#result-now { white-space: pre-wrap; margin-bottom: 10px; }
#history { color: #b9bec7; }

/* 로그인 전 화면 배너 광고 (오른쪽 위 280px, 휴대폰에서는 로그인 칸 위 가운데) */
.ad-banner { position: absolute; top: 72px; right: 24px; line-height: 0; z-index: 5; }
.ad-banner img { width: 280px; height: auto; border-radius: 10px; box-shadow: 0 4px 14px rgba(15, 30, 60, .18); transition: transform .15s; }
.ad-banner:hover img { transform: translateY(-1px); }
@media (max-width: 1000px) {
  .ad-banner { position: static; display: block; width: min(280px, 90%); margin: 16px auto 0; }
  .ad-banner img { width: 100%; }
  .ad-banner + .page .login-wrap { margin-top: 20px; }
}

/* 문제집 과목 진도 매트릭스: 단원별 푼 문제 수 */
table.matrix td.ucell { min-width: 76px; padding: 8px 10px; font-size: 13px; line-height: 1.3; }
table.matrix td.ucell.done { background: #c9efd7; } table.matrix td.ucell.in_progress { background: #fde7bf; }
table.matrix td.ucell.not_started { background: #fafbfc; color: #8a93a3; }

/* 출석 체크 */
.attend { text-align: center; }
.attend-btn { background: var(--orange); color: #fff; border: 0; font-weight: 800; padding: 10px 16px; border-radius: 10px; font-size: 15px; }
.attend-btn small { display: block; font-size: 11px; font-weight: 600; opacity: .9; }
.attend-btn:hover { filter: brightness(1.06); }
.attend-done { background: rgba(255,255,255,.14); color: #fff; padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.att-days { display: flex; gap: 4px; }
.att-days i { width: 18px; height: 18px; border-radius: 4px; background: #e5e9f0; display: block; }
.att-days i.on { background: #3fb871; }

/* 등급 안내 */
.profile .goal { margin-top: 6px; font-size: 12.5px; color: #ffd3b3; }
.profile .goal b { color: #fff; }
.guide-fold { margin: 10px 0 16px; padding: 10px 16px; }
.guide-fold summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.guide-fold[open] summary { margin-bottom: 10px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.guide-grid h3 { margin: 0 0 6px; font-size: 15px; }
.guide-grid table.list { margin: 0; }
.guide-me { margin-bottom: 14px; background: #fff7ef; border-color: #fde2c8; }
@media (max-width: 900px) { .guide-grid { grid-template-columns: 1fr; } }

/* 이전·다음 문제, 정렬 머리글 */
.prob-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.prob-move { display: flex; gap: 6px; align-items: center; }
table.list th.sortable a { color: inherit; text-decoration: none; white-space: nowrap; }
table.list th.sortable a:hover { text-decoration: underline; }
table.list th.sortable .arrow { font-size: 11px; opacity: .55; }
table.list th.sortable.on .arrow { opacity: 1; color: var(--orange); }

/* 처음 사용 안내 */
.tut { max-width: 920px; margin: 0 auto; }
.tut-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
.tut section.card { margin-bottom: 18px; scroll-margin-top: 70px; }
.tut section h2 { margin-top: 0; color: var(--navy); }
.tut figure { margin: 12px 0; }
.tut figure img { width: 100%; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 16px rgba(20, 40, 80, .08); }
.tut figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.tut table.list { margin: 10px 0; }
.tut ol li, .tut ul li { margin: 4px 0; }
.tut-faq dt { font-weight: 700; margin-top: 12px; }
.tut-faq dd { margin: 4px 0 0 0; color: var(--ink); }

/* 수업일지: 최근 1주일 일지 고르기 */
