:root {
  --teal: #0b6e66; --teal-d: #0b4f4a; --teal-l: #e6f3f1;
  --ink: #1d2327; --muted: #66727a; --line: #dfe5e8; --bg: #f5f7f8;
  --ok: #2e8b57; --part: #e3a72f; --bad: #d1495b; --none: #c9d1d6;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; word-break: keep-all; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 .4rem; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.break { word-break: break-all; }
code { background: #eef2f3; padding: 1px 5px; border-radius: 4px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.5rem; background: var(--teal-d); color: #fff; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 1.05rem; }
.topbar .brand span { font-weight: 400; opacity: .7; font-size: .85rem; margin-left: .4rem; }
.topbar .link { color: #fff; opacity: .85; }
.topnav { display: flex; align-items: center; gap: 1.1rem; font-size: .92rem; }
.topnav a { color: #fff; opacity: .9; }
.topnav form { margin: 0; }
.center-text { text-align: center; margin-top: 1rem; }
.wide-kpis { margin-bottom: 1rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.dept-block { margin-bottom: 1.4rem; }
.dept-block h3 { margin: .4rem 0 .5rem; }
.inline-form select { width: auto; min-width: 200px; }
.small-btn { font-size: .78rem; padding: .25rem .55rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.5rem; }
.narrow { max-width: 560px; margin: 0 auto; padding: 1.2rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.card.center { text-align: center; }
.card.empty { text-align: center; padding: 2.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.crumb { margin: 0; font-size: .85rem; color: var(--muted); }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }

button, .button { font: inherit; font-size: .92rem; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .9rem; border-radius: 8px; cursor: pointer; display: inline-block; }
button:hover, .button:hover { border-color: var(--teal); text-decoration: none; }
button.primary, .button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
button.primary:hover { background: var(--teal-d); }
button.danger { color: var(--bad); border-color: #f0c6cc; }
button.link { background: none; border: none; padding: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
.wide { width: 100%; padding: .8rem; font-size: 1rem; }

.form .field, label.field { display: block; margin-bottom: 1rem; }
.label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
input, textarea, select { width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid #cdd6da; border-radius: 8px; background: #fff; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--teal-l); border-color: var(--teal); }
.actions { display: flex; gap: .5rem; }
.err { color: var(--bad); }

.alert { padding: .7rem 1rem; border-radius: 8px; margin: 0 0 1rem; }
.alert.error { background: #fdecee; color: #8f1d2c; }
.alert.warn { background: #fff6e0; color: #6b4a00; }
.alert.info { background: var(--teal-l); color: var(--teal-d); }

.tag { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: #eef1f2; color: var(--muted); vertical-align: middle; }
.tag.open, .tag.ok { background: #e3f4ea; color: #1f6b40; }
.tag.run { background: #e6f0fb; color: #1d5fa8; }
.tag.warn { background: #fff1d6; color: #7a5200; }
.tag.bad { background: #fde3e6; color: #a1283a; }
.tag.demo { background: #f1e7fb; color: #6b3a9a; }
.chip { display: inline-block; font-size: .78rem; padding: 1px 8px; margin: 2px 3px 2px 0; border-radius: 6px; background: #eef1f2; }
.chip.low { background: #fde3e6; color: #8f1d2c; }
.chip.high { background: #e3f4ea; color: #1f6b40; }

.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: #f8fbfb; }

.grid { display: grid; gap: 1rem; }
.grid.top { grid-template-columns: minmax(420px, 1fr) 1fr; margin-bottom: 1rem; align-items: start; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.two.compact { margin-top: 1rem; }
.grid.sub { grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 860px) { .grid.top, .grid.two, .grid.sub { grid-template-columns: 1fr; } }

.qr-card { display: flex; gap: 1rem; align-items: center; margin: 0; }
.qr-card > div:last-child { flex: 1; min-width: 0; }
.qr svg { display: block; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; align-content: start; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column; justify-content: center; }
.kpi b { font-size: 1.8rem; color: var(--teal-d); line-height: 1.1; }
.kpi span { font-size: .85rem; color: var(--muted); }
.kpi.warn b { color: #b07800; }
.kpi.bad b { color: var(--bad); }

.analysis-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.legend { font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }
.sw.mastered, .seg.mastered, .cell.mastered, .pill.mastered { background: var(--ok); }
.sw.partial, .seg.partial, .cell.partial, .pill.partial { background: var(--part); }
.sw.not_mastered, .seg.not_mastered, .cell.not_mastered, .pill.not_mastered { background: var(--bad); }
.sw.not_covered, .seg.not_covered, .cell.not_covered, .pill.not_covered { background: var(--none); }
.bars { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 240px 1fr 90px; gap: .8rem; align-items: center; }
.bar-row.dim { opacity: .6; }
.bar-label { font-size: .9rem; }
.bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: #f0f3f4; }
.seg { color: #fff; font-size: .78rem; display: flex; align-items: center; justify-content: center; min-width: 18px; }
.seg.not_covered { color: #4b565c; }
.bar-num { display: flex; flex-direction: column; text-align: right; }
.bar-num b { font-size: 1.05rem; }
.bar-num b.low { color: var(--bad); }
.bar-num b.high { color: var(--ok); }
@media (max-width: 700px) { .bar-row { grid-template-columns: 1fr; } .bar-num { text-align: left; } }

.lead { font-size: 1.02rem; }
.panel { border-radius: 10px; padding: .8rem 1rem; }
.panel h3 { margin-top: 0; }
.panel.low { background: #fdf1f2; }
.panel.high { background: #eef8f2; }
.theme { margin-bottom: .7rem; }
.theme ul { margin: .2rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.theme p { margin: .2rem 0 0; font-size: .9rem; }
ul.raw { padding-left: 1.1rem; font-size: .9rem; }

.scroll-x { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; }
.heat th.num { width: 40px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.heat-key { font-size: .85rem; color: var(--muted); margin: 0 0 .6rem; }
.heat-key span { margin-right: .9rem; white-space: nowrap; }
.heat td.who { white-space: nowrap; padding-right: .8rem; font-size: .9rem; }
.heat td.cell { width: 40px; height: 26px; border-radius: 5px; cursor: pointer; }
.heat td.cell:not(.mastered):not(.partial):not(.not_mastered):not(.not_covered) { background: #f3f5f6; }

.concept-table td:first-child { min-width: 9.5rem; }
.concept-table td:nth-child(2) { white-space: nowrap; }
.pill { color: #fff; font-size: .78rem; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pill.not_covered { color: #3b464c; }
.turnref { font-size: .78rem; margin-left: 2px; }

.transcript { max-height: 85vh; overflow-y: auto; }
.msg { margin: 0 0 .8rem; padding: .6rem .8rem; border-radius: 10px; }
.msg.student { background: var(--teal-l); margin-left: 2.5rem; }
.msg.ai { background: #f4f6f7; margin-right: 2.5rem; }
.msg.dontknow { box-shadow: inset 4px 0 0 var(--bad); }
.msg .who { font-size: .75rem; color: var(--muted); }
.msg .text { white-space: pre-wrap; font-size: .92rem; }
.msg:target { outline: 2px solid var(--teal); }

.course-results { max-height: 280px; overflow-y: auto; margin-top: .4rem; display: flex; flex-direction: column; gap: .3rem; }
.course-option { text-align: left; width: 100%; }
.course-option.sel { border-color: var(--teal); background: var(--teal-l); }

.snippet { white-space: pre-wrap; background: #f4f6f7; border-radius: 8px; padding: .8rem 1rem; font-size: .85rem; }
.danger-zone { text-align: right; margin: 1.5rem 0; }

.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: .45rem; }
body.student { background: #eef4f3; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 2rem; line-height: 64px; margin: 0 auto .5rem; }
.preview { font-size: .88rem; color: #3b464c; }
.login { margin-top: 4rem; }

body.present { background: #fff; }
.present-wrap { padding: 2rem 3rem; text-align: center; }
.present-wrap h1 { font-size: 2.2rem; }
.present-grid { display: flex; align-items: center; justify-content: center; gap: 3rem; flex-wrap: wrap; margin-top: 1rem; }
.steps.big { text-align: left; font-size: 1.35rem; max-width: 520px; }
.present-url { font-size: 1.1rem; margin-top: 1.5rem; }
