/* 디자인 토큰: Linear 스타일 무채색, 포인트색은 보라(#5E6AD2) 하나 */
:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --subtle: #a1a1aa;
  --accent: #5e6ad2;          /* "확인 필요"에만 쓰는 포인트색 */
  --accent-soft: #eef0fb;
  --radius: 8px;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Inter', sans-serif;
  --touch: 44px;              /* iPad 터치 대상 최소 크기 */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
h1, h2, .display, .score { font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: 28px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
a { color: inherit; }
.muted { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.btn { min-height: var(--touch); padding: 0 16px; border-radius: 6px; border: 1px solid var(--border);
       background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: #fafafa; }
.btn.primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
input, select { min-height: var(--touch); padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
         background: #f4f4f5; color: var(--muted); border: 1px solid var(--border); }
.badge.attention { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.error { color: #b91c1c; font-size: 14px; }

/* 앱 레이아웃: 왼쪽 사이드바 */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.sidebar { border-right: 1px solid var(--border); padding: 20px 12px; background: var(--bg); }
.sidebar .brand { font-family: var(--font-display); font-weight: 700; font-size: 17px; padding: 0 8px 16px; }
.sidebar a { display: block; padding: 8px; border-radius: 6px; text-decoration: none; color: var(--muted); }
.sidebar a.active, .sidebar a:hover { background: #e9e9eb; color: var(--text); }
.main { padding: 32px; max-width: 1100px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.score { font-size: 40px; font-weight: 700; line-height: 1; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 500; }

/* 로그인 */
.center { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 360px; display: grid; gap: 12px; }

/* 시험 화면 (Bluebook과 비슷한 배치, 자체 디자인) */
.exam { display: grid; grid-template-rows: 56px 1fr 64px; height: 100vh; background: #fff;
        -webkit-touch-callout: none; }
.exam-top, .exam-bottom { display: flex; align-items: center; justify-content: space-between;
        padding: 0 16px; border-bottom: 1px solid var(--border); gap: 12px; }
.exam-bottom { border-bottom: 0; border-top: 1px solid var(--border); }
.timer { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.split { display: grid; grid-template-columns: var(--left, 50%) 8px 1fr; min-height: 0; }
.split > .pane { overflow: auto; padding: 24px 32px; }
.divider { background: var(--border); cursor: col-resize; touch-action: none; }
.q-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.q-num { background: var(--text); color: #fff; border-radius: 4px; padding: 2px 10px; font-weight: 600; }
.choice { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.choice button.opt { flex: 1; text-align: left; min-height: 52px; padding: 8px 14px; border: 1px solid var(--border);
        border-radius: 8px; background: #fff; font: inherit; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.choice button.opt.selected { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.choice.eliminated button.opt { text-decoration: line-through; color: var(--subtle); }
.choice .letter { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--text); display: grid; place-items: center; font-weight: 600; flex: none; }
.choice .strike { min-width: var(--touch); min-height: var(--touch); border: 0; background: none; cursor: pointer; color: var(--muted); }
.flag.on { color: var(--accent); border-color: var(--accent); }
.nav-pop { position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%); background: #fff;
        border: 1px solid var(--border); border-radius: 10px; padding: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.grid-nums { display: grid; grid-template-columns: repeat(10, 40px); gap: 6px; margin: 12px 0; }
.grid-nums button { height: 40px; border: 1px dashed var(--subtle); background: #fff; border-radius: 4px; cursor: pointer; font: inherit; position: relative; }
.grid-nums button.answered { border: 1px solid var(--text); background: #f4f4f5; }
.grid-nums button.current { outline: 2px solid var(--text); }
.grid-nums button.review::after { content: '⚑'; color: var(--accent); position: absolute; top: -8px; right: -4px; font-size: 12px; }
.drawer { position: fixed; top: 56px; right: 0; bottom: 64px; width: 380px; background: #fff; border-left: 1px solid var(--border); padding: 20px; overflow: auto; }
.watermark { position: fixed; inset: 0; pointer-events: none; display: grid; place-items: center;
        font-size: 64px; color: rgba(0,0,0,.035); transform: rotate(-24deg); user-select: none; z-index: 5; }
.figure img { max-width: 100%; }
@media print { body { display: none; } }

/* 문제 텍스트 (richText): 문단·목록 간격, 보기 안의 표와 그림 */
.opt-body p, .opt-body ul { margin: 0; }
.opt-body .figure { margin-top: 6px; }
.pane p { margin: 0 0 12px; }
.part { margin: 16px 0; }
.part > strong { display: block; margin-bottom: 4px; }
.figure { margin: 8px 0 16px; }
.expl { margin: 8px 0; }

/* 선생 포털: 문제은행 검수·가져오기 */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.review { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.review .meta dt { color: var(--muted); font-size: 13px; margin-top: 8px; }
.review .meta dd { margin: 0; }
.choice-row { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.choice-row.correct { border-color: var(--text); box-shadow: inset 3px 0 0 var(--text); }
.choice-row p { display: inline; margin: 0; }
.rubric { background: #fafafa; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.rubric li p { display: inline; margin: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafafa; }
