/* 엠스트 웹앱(회원 포털) 목업 — 모바일 앱 기준, 900px 이상에서 사이드 메뉴로 확장 */
:root {
  --blue: #1f3d99;
  --blue-d: #142a6e;
  --blue-l: #eaf0ff;
  --red: #e60012;
  --red-l: #ffecee;
  --ink: #333;
  --sub: #5b5b5b;
  --mute: #8a8f99;
  --line: #e3e7ef;
  --bg: #f3f5fa;
  --card: #fff;
  --green: #16865a;
  --green-l: #e5f6ee;
  --amber: #b86b00;
  --amber-l: #fff3df;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 42, 110, .06), 0 4px 14px rgba(20, 42, 110, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", -apple-system, "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.55; word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- mock-bar ---------- */
.mock-bar {
  background: #111; color: #aaa; font-size: 12.5px; padding: 7px 14px;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
}
.mock-bar b { color: #fff; margin-right: 4px; }
.mock-bar a { color: #ddd; }
.mock-bar a:hover { color: #fff; }
.mock-bar a.on { color: #fff; font-weight: 700; text-decoration: underline; }
.mock-bar .grp { color: #ffd34d; font-weight: 700; margin-left: 6px; }
.mock-bar .sep { color: #555; }

/* ---------- 앱 셸 ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 32px); }
.side {
  background: #fff; border-right: 1px solid var(--line); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}
.side-logo img { width: 170px; }
.side-user { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--blue-l); }
.side-user b { display: block; font-size: 15px; color: var(--blue-d); }
.side-user small { color: var(--sub); font-size: 12.5px; }
.av {
  width: 38px; height: 38px; border-radius: 50%; background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.av.red { background: var(--red); }
.av.gray { background: #9aa3b5; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .lbl { font-size: 11.5px; color: var(--mute); font-weight: 700; margin: 10px 10px 4px; letter-spacing: .02em; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #444; font-weight: 500; }
.side-nav a:hover { background: #f4f6fb; }
.side-nav a.on { background: var(--blue); color: #fff; font-weight: 700; }
.side-foot { margin-top: auto; font-size: 12.5px; color: var(--sub); border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.side-foot a { color: var(--blue); font-weight: 600; }
.side-foot .tel { color: var(--red); font-weight: 800; font-size: 15px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); height: 60px; padding: 0 24px; display: flex; align-items: center; gap: 10px;
}
.appbar h1 { font-size: 19px; font-weight: 800; color: var(--blue-d); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-back, .ab-logo { display: none; }
.ab-logo img { height: 30px; width: auto; }
.ab-role { font-size: 12px; font-weight: 700; color: var(--blue); background: var(--blue-l); padding: 3px 9px; border-radius: 99px; }
.ab-act { display: flex; gap: 4px; }
.ib { position: relative; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #444; }
.ib:hover { background: #f1f3f8; }
.ib .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid #fff; }
.content { padding: 24px; width: 100%; max-width: 1120px; }
.tabbar { display: none; }

/* 역할별 내비 전환 (공통 화면에서 3개 역할 메뉴를 모두 갖고 body[data-role]로 선택) */
body[data-role="student"] [data-nav]:not([data-nav="student"]),
body[data-role="parent"] [data-nav]:not([data-nav="parent"]),
body[data-role="teacher"] [data-nav]:not([data-nav="teacher"]) { display: none !important; }

/* 응시 화면: 집중 모드 */
body.focus .app { grid-template-columns: minmax(0, 1fr); }
body.focus .side, body.focus .tabbar { display: none !important; }
body.focus .content { max-width: 1040px; margin: 0 auto; }

/* ---------- 공통 컴포넌트 ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; }
.g-side { grid-template-columns: 300px minmax(0, 1fr); }
.span2 { grid-column: span 2; }
.stack { display: grid; gap: 16px; align-content: start; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 16.5px; font-weight: 800; color: #1d2433; }
.card-h .more { font-size: 13px; color: var(--blue); font-weight: 600; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.sec-t { font-size: 17px; font-weight: 800; margin: 26px 0 12px; color: #1d2433; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.xs { font-size: 12px; color: var(--mute); }
.red { color: var(--red); }
.blue { color: var(--blue); }
.note { font-size: 12.5px; color: var(--mute); background: #f7f8fb; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.note b { color: var(--sub); }

.hero {
  background: linear-gradient(135deg, var(--blue-d), var(--blue) 60%, #3559c4); color: #fff;
  border-radius: 18px; padding: 22px; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero h2 { font-size: 21px; font-weight: 800; line-height: 1.4; }
.hero h2 em { font-style: normal; color: #ffd0d4; }
.hero p { opacity: .88; font-size: 14px; margin-top: 6px; }
.hero .hero-stats { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .hero-stats span { background: rgba(255, 255, 255, .14); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.hero .hero-stats b { font-size: 17px; margin-left: 4px; }

.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.kpi .k { font-size: 12.5px; color: var(--sub); }
.kpi .v { font-size: 24px; font-weight: 800; color: var(--blue-d); margin-top: 2px; }
.kpi .v small { font-size: 13px; font-weight: 600; color: var(--sub); margin-left: 2px; }
.kpi .d { font-size: 12px; margin-top: 2px; }
.kpi .d.up { color: var(--green); }
.kpi .d.down { color: var(--red); }
.kpi.alert .v { color: var(--red); }

.bar { height: 8px; background: #e9edf5; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar.red i { background: var(--red); }
.bar.green i { background: var(--green); }
.bar.amber i { background: #e59a1a; }
.prog-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; }
.prog-row b { text-align: right; font-size: 13.5px; }

.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #eef1f6; min-width: 0; }
.li:first-child { border-top: 0; padding-top: 2px; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 700; font-size: 14.5px; }
.li .s { font-size: 12.5px; color: var(--sub); }
.li .time { font-size: 12.5px; font-weight: 700; color: var(--blue); min-width: 64px; }
.li .side-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.li-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-l); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.li-ico.red { background: var(--red-l); color: var(--red); }
.li-ico.green { background: var(--green-l); color: var(--green); }
.li-ico.amber { background: var(--amber-l); color: var(--amber); }

.bd { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: #eef0f4; color: #555; white-space: nowrap; }
.bd.blue { background: var(--blue-l); color: var(--blue); }
.bd.red { background: var(--red-l); color: var(--red); }
.bd.green { background: var(--green-l); color: var(--green); }
.bd.amber { background: var(--amber-l); color: var(--amber); }
.bd.navy { background: var(--blue-d); color: #fff; }
.bd.line { background: #fff; border: 1px solid var(--line); }
.verified { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--green); background: var(--green-l); padding: 4px 10px; border-radius: 99px; }
.verified .ico { width: 15px; height: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c8cfdd; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: var(--blue-l); border-color: var(--blue-l); color: var(--blue); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.kakao { background: #fee500; border-color: #fee500; color: #191919; }
.btn.naver { background: #03c75a; border-color: #03c75a; color: #fff; }
.btn .ico { width: 17px; height: 17px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btns.end { justify-content: flex-end; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: #444; white-space: nowrap; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; white-space: nowrap; }
.tabs a { padding: 11px 14px; font-weight: 700; color: var(--mute); border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }
.pane { display: none; }
.pane.on { display: block; }

/* 폼 */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .lb { font-size: 13.5px; font-weight: 700; color: #444; }
.field .req { color: var(--red); }
.inp, .sel, .ta { width: 100%; height: 44px; border: 1px solid #d6dbe6; border-radius: 10px; padding: 0 12px; background: #fff; }
.ta { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.inp:focus, .sel:focus, .ta:focus { outline: 2px solid rgba(31, 61, 153, .25); border-color: var(--blue); }
.row { display: flex; gap: 8px; }
.row > .inp, .row > .sel { flex: 1; min-width: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); flex: none; }
.check a { color: var(--blue); text-decoration: underline; margin-left: auto; font-size: 12.5px; white-space: nowrap; }
.divider { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--mute); margin: 18px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 스위치 */
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cfd5e1; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(20px); }

/* 표 */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { background: #f5f7fb; color: #555; font-weight: 700; text-align: left; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.tbl tr.hl td { background: #fbfcff; }
.tbl .c { text-align: center; }

/* 학습 루프 */
.loop { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; counter-reset: lp; }
.loop li { list-style: none; background: #f4f6fb; border-radius: 12px; padding: 10px 6px; text-align: center; position: relative; }
.loop li b { display: block; font-size: 14.5px; }
.loop li small { display: block; font-size: 11.5px; color: var(--mute); }
.loop li.done { background: var(--blue-l); color: var(--blue-d); }
.loop li.now { background: var(--blue); color: #fff; }
.loop li.now small { color: #dfe6ff; }
.loop li .st { font-size: 11px; font-weight: 700; display: block; margin-top: 2px; }
ol.loop { padding: 0; margin: 0; }

/* 세그먼트 버튼 (출결 등) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 10px; font-size: 13px; font-weight: 700; color: var(--mute); cursor: pointer; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button.on[data-v="출석"] { background: var(--green-l); color: var(--green); }
.seg button.on[data-v="지각"] { background: var(--amber-l); color: var(--amber); }
.seg button.on[data-v="결석"] { background: var(--red-l); color: var(--red); }
.seg button.on[data-v="조퇴"] { background: #eef0f4; color: #444; }
.seg button.on { background: var(--blue-l); color: var(--blue); }

/* 달력 */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; text-align: center; font-size: 13px; }
.cal .h { font-size: 12px; color: var(--mute); font-weight: 700; padding: 4px 0; }
.cal .d { border-radius: 9px; padding: 7px 0 5px; background: #f6f7fa; min-height: 46px; }
.cal .d i { display: block; width: 7px; height: 7px; border-radius: 50%; margin: 4px auto 0; }
.cal .d.ok i { background: var(--green); }
.cal .d.late i { background: #e59a1a; }
.cal .d.abs i { background: var(--red); }
.cal .d.today { outline: 2px solid var(--blue); background: #fff; }
.cal .d.off { background: none; color: #c3c8d2; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--sub); margin-top: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* 주간 출석 점 */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; }
.week div { font-size: 12px; color: var(--mute); }
.week span { display: flex; align-items: center; justify-content: center; margin: 4px auto 0; width: 30px; height: 30px; border-radius: 50%; background: #eef0f4; font-size: 11px; font-weight: 700; color: #9aa; }
.week span.ok { background: var(--green-l); color: var(--green); }
.week span.late { background: var(--amber-l); color: var(--amber); }
.week span.today { background: var(--blue); color: #fff; }

/* 막대 차트 (CSS) */
.hbar { display: grid; gap: 10px; }
.hbar .r { display: grid; grid-template-columns: 76px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar .r .bar { height: 14px; }
.hbar .r b { text-align: right; }
.vchart { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding: 10px 4px 0; border-bottom: 1px solid var(--line); }
.vchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.vchart .col i { display: block; width: 100%; max-width: 38px; background: #c9d5f5; border-radius: 6px 6px 0 0; }
.vchart .col.cur i { background: var(--blue); }
.vchart .col b { font-size: 12px; }
.vlabels { display: flex; gap: 12px; padding: 6px 4px 0; }
.vlabels span { flex: 1; text-align: center; font-size: 11.5px; color: var(--mute); min-width: 0; }

/* 업로드 */
.upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed #c6cfe2;
  border-radius: 14px; padding: 22px 12px; text-align: center; color: var(--sub); cursor: pointer; background: #fafbfe;
}
.upload:hover { border-color: var(--blue); color: var(--blue); }
.upload input { display: none; }
.upload .ico { width: 30px; height: 30px; color: var(--blue); }
.pv { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.pv .th { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 3/4; background: repeating-linear-gradient(0deg, #fff, #fff 13px, #e8ecf4 14px); border: 1px solid var(--line); }
.pv .th img { width: 100%; height: 100%; object-fit: cover; }
.pv .th span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; background: rgba(0, 0, 0, .55); color: #fff; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv .th button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; line-height: 1; }
.pv .th.doc { display: flex; align-items: center; justify-content: center; background: #f2f5fc; color: var(--blue); font-weight: 800; }

/* 진행 단계 */
.steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 18px; }
.steps li { flex: 1; text-align: center; font-size: 12.5px; color: var(--mute); position: relative; padding-top: 30px; font-weight: 600; min-width: 0; }
.steps li::before { content: attr(data-n); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: #e3e7ef; color: #fff; font-size: 12px; line-height: 24px; font-weight: 800; z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: #e3e7ef; }
.steps li:first-child::after { display: none; }
.steps li.done, .steps li.now { color: var(--blue-d); }
.steps li.done::before, .steps li.now::before { background: var(--blue); }
.steps li.done::after, .steps li.now::after { background: var(--blue); }
.steps li.now::before { box-shadow: 0 0 0 4px rgba(31, 61, 153, .18); }
.steps li.bad { color: var(--red); }
.steps li.bad::before { background: var(--red); }

/* 영상 썸네일 */
.vod { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.vod-item { background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.vod-th { aspect-ratio: 16/9; background: linear-gradient(135deg, #22357a, #4d6fd6); position: relative; display: flex; align-items: center; justify-content: center; color: #fff; }
.vod-th.alt { background: linear-gradient(135deg, #7a1c2a, #e64457); }
.vod-th.alt2 { background: linear-gradient(135deg, #1f5b52, #33a58f); }
.vod-th .play { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: flex; align-items: center; justify-content: center; }
.vod-th .len { position: absolute; right: 8px; bottom: 8px; font-size: 11.5px; background: rgba(0, 0, 0, .55); padding: 1px 6px; border-radius: 4px; }
.vod-th .sub { position: absolute; left: 10px; top: 8px; font-size: 12px; font-weight: 700; opacity: .9; }
.vod-b { padding: 10px 12px 12px; }
.vod-b .t { font-weight: 700; font-size: 14px; }
.vod-b .bar { margin-top: 8px; height: 5px; }

/* 문항 (응시) */
.exam-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 16px; }
.exam-top .ttl { flex: 1; min-width: 160px; font-weight: 800; }
.timer { font-size: 22px; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.timer .ico { width: 20px; height: 20px; }
.q-no { font-size: 13px; font-weight: 800; color: var(--blue); }
.q-text { font-size: 17px; font-weight: 700; margin: 6px 0 12px; line-height: 1.6; }
.passage { background: #f7f8fb; border-left: 4px solid var(--blue); border-radius: 8px; padding: 12px 14px; font-size: 14.5px; color: #444; margin-bottom: 14px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fff; text-align: left; width: 100%; }
.opt .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #b8c0d2; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex: none; color: #667; }
.opt.on { border-color: var(--blue); background: var(--blue-l); }
.opt.on .n { background: var(--blue); border-color: var(--blue); color: #fff; }
.palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.palette button { height: 38px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; position: relative; }
.palette button.ans { background: var(--blue-l); color: var(--blue); border-color: #c9d6fb; }
.palette button.cur { outline: 2px solid var(--blue); }
.palette button.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* 인증 화면 */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 32px); }
.auth-brand {
  background: linear-gradient(150deg, var(--blue-d), var(--blue) 70%); color: #fff; padding: 56px 56px; display: flex; flex-direction: column; justify-content: center; gap: 16px;
}
.auth-brand .eyebrow { font-size: 12.5px; letter-spacing: .14em; font-weight: 700; opacity: .75; }
.auth-brand h2 { font-size: 38px; line-height: 1.3; font-weight: 800; }
.auth-brand h2 em { font-style: normal; color: #fff; background: var(--red); padding: 0 8px; border-radius: 6px; }
.auth-brand p { font-size: 15.5px; opacity: .9; max-width: 440px; }
.auth-brand .tags { font-size: 14px; opacity: .75; }
.auth-brand .loop-mini { display: flex; gap: 6px; flex-wrap: wrap; padding: 0; margin: 4px 0 0; list-style: none; }
.auth-brand .loop-mini li { background: rgba(255, 255, 255, .14); border-radius: 99px; padding: 6px 14px; font-weight: 700; font-size: 13.5px; }
.auth-brand .loop-mini li + li::before { content: "→ "; opacity: .6; }
.auth-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { width: 190px; margin-bottom: 18px; }
.auth-card h1 { font-size: 24px; font-weight: 800; color: var(--blue-d); margin-bottom: 4px; }
.auth-card .lead { color: var(--sub); font-size: 14px; margin-bottom: 18px; }
.role-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.role-pick .chip { border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; }
.role-pick .chip .ico { width: 22px; height: 22px; }
.auth-links { display: flex; justify-content: center; gap: 14px; font-size: 13px; color: var(--sub); margin-top: 14px; }
.auth-links a:hover { color: var(--blue); }
.sns { display: grid; gap: 8px; }
.role-card { display: flex; gap: 12px; align-items: center; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; margin-bottom: 10px; }
.role-card input { accent-color: var(--blue); width: 18px; height: 18px; }
.role-card:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }
.role-card b { display: block; }
.role-card small { color: var(--sub); }
.guardian { display: none; border: 1px solid #f3c2c7; background: #fff8f8; border-radius: 12px; padding: 14px; margin: 10px 0; }
.guardian.on { display: block; }
.agree-all { background: var(--blue-l); border-radius: 12px; padding: 12px 14px; font-weight: 800; margin-bottom: 10px; }
.agree-list { display: grid; gap: 10px; padding: 4px 4px 0; }

/* 코드 박스 */
.code-box { font-size: 28px; font-weight: 800; letter-spacing: .12em; text-align: center; color: var(--blue-d); background: var(--blue-l); border-radius: 12px; padding: 16px 8px; font-variant-numeric: tabular-nums; }

/* 처방·리포트 */
.quote { border-left: 4px solid var(--red); background: #fffafa; border-radius: 8px; padding: 12px 14px; font-size: 14.5px; }
.quote .by { display: block; font-size: 12.5px; color: var(--sub); margin-top: 6px; }
.weak { display: grid; gap: 10px; }
.weak-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.weak-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
details.exp { margin-top: 8px; font-size: 13.5px; }
details.exp summary { cursor: pointer; color: var(--blue); font-weight: 700; }
details.exp div { background: #f7f8fb; border-radius: 8px; padding: 10px 12px; margin-top: 6px; color: #444; }

/* 결제 */
.course { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; margin-bottom: 10px; background: #fff; }
.course input { accent-color: var(--blue); width: 18px; height: 18px; margin-top: 3px; flex: none; }
.course:has(input:checked) { border-color: var(--blue); background: #f7f9ff; }
.course .grow { flex: 1; min-width: 0; }
.course .price { font-weight: 800; color: var(--blue-d); white-space: nowrap; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.sum-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 17px; font-weight: 800; }
.sum-row.total b { color: var(--red); }
.sticky { position: sticky; top: 76px; }

/* 알림 */
.noti { display: flex; gap: 12px; padding: 14px 4px; border-top: 1px solid #eef1f6; position: relative; }
.noti:first-child { border-top: 0; }
.noti .grow { flex: 1; min-width: 0; }
.noti .t { font-weight: 700; }
.noti .s { font-size: 13.5px; color: var(--sub); }
.noti .tm { font-size: 12px; color: var(--mute); white-space: nowrap; }
.noti.unread { background: #f7f9ff; border-radius: 10px; }
.noti.unread .t::after { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--red); border-radius: 50%; margin-left: 6px; vertical-align: middle; }

/* 설정 행 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid #eef1f6; }
.set-row:first-child { border-top: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row small { display: block; color: var(--mute); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* 모달 */
.dim { position: fixed; inset: 0; background: rgba(10, 18, 40, .5); z-index: 100; display: none; align-items: center; justify-content: center; padding: 12px; }
.dim.on { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 440px; max-width: 100%; max-height: calc(100vh - 24px); overflow-y: auto; padding: 22px; }
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--sub); font-size: 14.5px; }
.modal .btns { justify-content: flex-end; }
.modal .ok-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--green-l); color: var(--green); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.modal .ok-ico .ico { width: 28px; height: 28px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #1d2433; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .25s; z-index: 200; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 그레이딩 */
.answer-img { border: 1px solid var(--line); border-radius: 12px; background: repeating-linear-gradient(0deg, #fff, #fff 25px, #e8ecf4 26px); padding: 18px 16px; font-family: "Nanum Pen Script", "Malgun Gothic", cursive; font-size: 15px; color: #233a8a; line-height: 26px; min-height: 180px; }
.rubric { display: grid; gap: 8px; }
.rubric .r { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; align-items: center; font-size: 14px; }
.rubric .r .inp { height: 38px; text-align: center; }
.sel-list .li { cursor: pointer; padding: 12px; border-radius: 10px; border-top: 0; margin-bottom: 4px; }
.sel-list .li.on { background: var(--blue-l); }

/* ---------- 반응형 ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .mock-bar { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
  .app { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .side { display: none; }
  .appbar { height: 54px; padding: 0 8px 0 12px; gap: 6px; }
  .appbar h1 { font-size: 17px; }
  .ab-back { display: inline-flex; }
  .ab-logo { display: inline-flex; }
  .ab-role { display: none; }
  .appbar.home h1 { display: none; }
  .appbar.home .ab-spacer { flex: 1; }
  .content { padding: 16px 16px 96px; }
  body.focus .content { padding-bottom: 32px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(20, 42, 110, .06);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: #8a8f99; padding: 4px 0; min-width: 0; }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--blue); font-weight: 800; }
  .tabbar a.on .ico { stroke-width: 2.4; }
  .tabbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .g3 { grid-template-columns: minmax(0, 1fr); }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-brand { padding: 26px 20px; gap: 10px; }
  .auth-brand h2 { font-size: 25px; }
  .auth-brand p { font-size: 14px; }
  .auth-brand .loop-mini li { padding: 4px 10px; font-size: 12.5px; }
  .auth-wrap { padding: 24px 16px 40px; align-items: flex-start; }
  .tw .tbl { min-width: 640px; }
  .tbl td, .tbl th { white-space: nowrap; }
  /* 열이 적은 표(.fit)는 가로 스크롤 없이 화면 폭에 맞춰 줄바꿈 */
  .tw .tbl.fit { min-width: 0; }
  .tbl.fit td, .tbl.fit th { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
  .tbl.fit th:first-child, .tbl.fit td:first-child { width: 48%; }
  .toast { bottom: 84px; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid { gap: 12px; }
  .card { padding: 15px; border-radius: 12px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 21px; }
  .hero { padding: 18px; border-radius: 16px; }
  .hero h2 { font-size: 18.5px; }
  .hero .hero-stats span { padding: 6px 10px; font-size: 12.5px; }
  .loop { gap: 4px; }
  .loop li { padding: 8px 2px; border-radius: 10px; }
  .loop li b { font-size: 13px; }
  .loop li small { display: none; }
  .li { flex-wrap: wrap; }
  .li .side-act { width: 100%; justify-content: flex-start; }
  .li.keep { flex-wrap: nowrap; }
  .li.keep .side-act { width: auto; }
  .kv { grid-template-columns: 92px minmax(0, 1fr); }
  .btns .btn { flex: 1 1 auto; }
  .q-text { font-size: 16px; }
  .timer { font-size: 19px; }
  .hbar .r { grid-template-columns: 64px minmax(0, 1fr) 48px; gap: 8px; font-size: 12.5px; }
  .prog-row { grid-template-columns: 56px minmax(0, 1fr) 40px; }
  .vchart { gap: 6px; }
  .vlabels { gap: 6px; }
  .steps li { font-size: 11px; }
  .code-box { font-size: 23px; }
  .cal .d { min-height: 40px; padding: 6px 0 4px; }
  .rubric .r { grid-template-columns: minmax(0, 1fr) 76px; }
  .row.wrap { flex-wrap: wrap; }
  .row.wrap > .btn { flex: 1 1 100%; }
  .noti .tm { position: absolute; right: 4px; top: 14px; }
  .noti .grow { padding-right: 56px; }
}
