/* 차분한 학습용: 따뜻한 회백 바탕, 남색 강조. 다크는 같은 색조의 어두운 판 */
:root {
  --bg: #f6f4ef;
  --surface: #fffefb;
  --surface-2: #f0ece4;
  --text: #22252b;
  --muted: #6c6a65;
  --border: #e2ddd3;
  --border-strong: #cfc8bb;
  --accent: #34508a;
  --accent-strong: #263d6d;
  --accent-soft: #e7ecf5;
  --on-accent: #ffffff;
  --ok: #2c7650;
  --ok-soft: #e3f1e8;
  --bad: #b13e36;
  --bad-soft: #f8e5e2;
  --warn: #8a5f05;
  --warn-soft: #f9efd3;
  --code-bg: #f0ebe2;
  --heat-1: #f3d4cd;
  --heat-2: #e19b8f;
  --heat-3: #c0483d;
  --shadow: 0 1px 2px rgb(60 50 30 / .05), 0 2px 8px rgb(60 50 30 / .04);
  --radius: 12px;
  --sans: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161614;
    --surface: #1f1f1c;
    --surface-2: #2a2926;
    --text: #e9e6df;
    --muted: #a29d93;
    --border: #36342f;
    --border-strong: #4a4740;
    --accent: #9fb6e3;
    --accent-strong: #c0d0ef;
    --accent-soft: #252f44;
    --on-accent: #12161f;
    --ok: #7cc79c;
    --ok-soft: #1b3125;
    --bad: #ef958b;
    --bad-soft: #3b2220;
    --warn: #e2bc68;
    --warn-soft: #362d17;
    --code-bg: #2a2926;
    --heat-1: #4a2a25;
    --heat-2: #874036;
    --heat-3: #d05b4e;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161614;
  --surface: #1f1f1c;
  --surface-2: #2a2926;
  --text: #e9e6df;
  --muted: #a29d93;
  --border: #36342f;
  --border-strong: #4a4740;
  --accent: #9fb6e3;
  --accent-strong: #c0d0ef;
  --accent-soft: #252f44;
  --on-accent: #12161f;
  --ok: #7cc79c;
  --ok-soft: #1b3125;
  --bad: #ef958b;
  --bad-soft: #3b2220;
  --warn: #e2bc68;
  --warn-soft: #362d17;
  --code-bg: #2a2926;
  --heat-1: #4a2a25;
  --heat-2: #874036;
  --heat-3: #d05b4e;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--sans);
  letter-spacing: -0.005em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, select, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
code, pre { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--code-bg); padding: 0.12em 0.4em; border-radius: 5px; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 10px; overflow-x: auto; white-space: pre; margin: 10px 0; line-height: 1.55; }
pre code { background: none; padding: 0; font-size: 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 상단 막대 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 10px max(16px, calc((100% - 880px) / 2));
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-mark {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font: 700 0.72rem/1 var(--mono); letter-spacing: -0.04em;
}
.sync { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.sync::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: 1px; }
.sync.busy::before { background: var(--accent); }
.sync.busy { color: var(--accent); }
.sync.error::before { background: var(--bad); }
.sync.error { color: var(--bad); font-weight: 600; }
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; min-width: 0; }
.bar:empty { display: none; }
.bar:empty ~ .themebtn { margin-left: auto; }
.themebtn {
  flex: none; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 0.95rem; line-height: 1;
}
.themebtn:hover { color: var(--text); border-color: var(--border-strong); }
.progress { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 150px; }
.progress .track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.progress .small { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dockbtns { display: flex; gap: 6px; }

main { max-width: 880px; margin: 0 auto; padding: 24px 16px 96px; }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 8px 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; margin: 36px 0 12px; letter-spacing: -0.01em; }
h1 + p.muted { margin-top: 0; }

.btn {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 9px;
  padding: 7px 14px; cursor: pointer; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500; line-height: 1.4; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border-strong); }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn.small { padding: 4px 11px; font-size: 0.875rem; border-radius: 8px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
a.card { transition: border-color .12s, transform .12s; }
a.card:hover { border-color: var(--accent); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.errors { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }

/* 홈 */
.lead { margin: 0 0 4px; }
.resume { display: grid; gap: 10px; }
.resumecard {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text);
  border-color: var(--accent); background: var(--accent-soft); box-shadow: none;
}
.resumecard > div { flex: 1; min-width: 0; }
.resumecard .go { flex: none; font-weight: 600; color: var(--accent); white-space: nowrap; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.tile { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); padding: 14px 16px; }
.tile-k { font-weight: 600; font-size: 0.95rem; }
.tile-v { font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile-v small { font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-left: 2px; }
.tile .small { line-height: 1.45; }
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.weekcard { display: flex; gap: 14px; text-decoration: none; color: var(--text); padding: 14px 16px; align-items: flex-start; }
.wk {
  flex: none; width: 46px; height: 46px; border-radius: 10px; background: var(--surface-2);
  display: grid; place-content: center; text-align: center; font-weight: 700; font-size: 1.15rem; line-height: 1.05;
}
.wk small { display: block; font-size: 0.62rem; font-weight: 600; color: var(--muted); }
.wkbody { flex: 1; min-width: 0; }
.wktitle { font-weight: 600; }
.wkstats { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); margin-top: 2px; }
.wkstats b { color: var(--text); font-weight: 600; }
.meter { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.weekcard .meter > i { background: var(--ok); }
.inprogress { color: var(--accent); margin-top: 4px; font-weight: 600; }
.inprogress-card { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.inprogress-card .actions { margin-top: 10px; }
.inprogress-card p { margin: 10px 0 0; }
.lmsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 24px; padding: 8px 18px; }
.setlink { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 8px; margin: 0 -8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.setlink:hover { background: var(--surface-2); }
details.fold { margin-top: 10px; padding: 0; }
details.fold > summary {
  list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--text); font-size: 1rem;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "펼치기"; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
details.fold[open] > summary::after { content: "접기"; }
details.fold > summary .muted { font-weight: 400; }
details.fold > form { border-top: 1px solid var(--border); padding: 4px 18px 16px; }
details.fold[open] > summary { border-bottom: 0; }

.tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 1.5; }
.tag.variant { background: var(--accent-soft); color: var(--accent); }
.tag.exam { background: var(--ok-soft); color: var(--ok); }
.tag.bad { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.tag.mark-unsure { background: var(--warn-soft); color: var(--warn); }
.tag.mark-guess { background: var(--bad-soft); color: var(--bad); }

/* 입력 양식 */
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.form-row > .label { width: 84px; color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 4px 13px; cursor: pointer; user-select: none; font-size: 0.92rem; background: var(--surface); line-height: 1.5;
}
.chip:hover { border-color: var(--accent); }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.chip:has(input:checked) .muted { color: var(--accent); opacity: .75; }
.chip:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.chip input { margin: 0; accent-color: var(--accent); }
select { border: 1px solid var(--border-strong); border-radius: 9px; padding: 6px 10px; background: var(--surface); }
form.card > p.muted { margin: 12px 0; }

/* 표 */
.tablewrap { padding: 0; overflow-x: auto; }
.tablehead { padding: 12px 16px 4px; font-weight: 600; }
table.hist { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.hist th, .hist td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.hist td.small { white-space: normal; min-width: 140px; }
.hist th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.hist tr:last-child td { border-bottom: 0; }
.tablewrap + .tablewrap { margin-top: 12px; }
.rowbtns { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
td.rowbtns { display: table-cell; text-align: right; white-space: normal !important; min-width: 120px; }
td.rowbtns > * { margin: 2px 0 2px 4px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.stats .card { padding: 14px 16px; }
.stats .big { font-size: 1.6rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }

/* 문항별 오답 격자·응답 현황 */
.heat, .navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.cell, .navcell {
  position: relative; display: grid; place-items: center; height: 36px; border-radius: 7px;
  font-size: 0.8rem; text-decoration: none; color: var(--text); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); background: var(--surface);
}
.cell.unseen { color: var(--muted); border-style: dashed; background: transparent; }
.cell.w0:not(.unseen) { background: var(--ok-soft); border-color: transparent; }
.cell.w1 { background: var(--heat-1); border-color: transparent; }
.cell.w2 { background: var(--heat-2); border-color: transparent; }
.cell.w3 { background: var(--heat-3); border-color: transparent; color: #fff; }
.cell:hover, .navcell:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; }
.dot.unsure { background: var(--warn); }
.dot.guess { background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 0 0 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.navcard { margin-top: 24px; }
.navcard h2 { margin-top: 0; }
.navcell.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* 오답·체크 목록 */
.qlist { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.qrow { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.qrow > a { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; text-decoration: none; color: var(--text); min-width: 0; }
.qrow:hover { border-color: var(--accent); }
.qrow .snip { flex-basis: 100%; font-size: 0.92rem; }

/* 문항 */
.q { margin: 14px 0; padding: 20px; position: relative; }
.q.is-ok { border-left: 4px solid var(--ok); }
.q.is-wrong { border-left: 4px solid var(--bad); }
.only-wrong .q.is-ok { display: none; }
.q-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.q-num {
  flex: none; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; background: var(--surface-2);
  display: grid; place-items: center; font-weight: 700; font-size: 0.92rem; font-variant-numeric: tabular-nums;
}
.q-meta { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-height: 30px; }
.stars { color: var(--warn); font-size: 0.8rem; letter-spacing: 1px; }
.marks { flex: none; display: inline-flex; gap: 4px; }
.mark {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 3px 11px; font-size: 0.8rem; cursor: pointer; line-height: 1.4;
}
.mark:hover { border-color: var(--warn); color: var(--text); }
.mark-unsure[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 600; }
.mark-guess[aria-pressed="true"] { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); font-weight: 600; }
.stem { white-space: pre-wrap; margin: 0 0 14px; font-weight: 500; font-size: 1.02rem; line-height: 1.75; }
.stem.md, .md { white-space: normal; }
.stem.md p, .md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 1.4em; }
.md blockquote, .verdict blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 8px 8px 0; font-size: 0.92rem; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.opt {
  width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px 14px;
  background: var(--surface); cursor: pointer; white-space: pre-wrap; line-height: 1.6;
  transition: background .12s, border-color .12s;
}
.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.opt:disabled { cursor: default; }
.opt .n {
  flex: none; width: 1.7em; height: 1.7em; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-size: 0.82rem; font-weight: 600; margin-top: 0; font-variant-numeric: tabular-nums;
}
.opt .t { flex: 1; min-width: 0; }
.opt .t pre { white-space: pre; }
.opt.picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.picked .n { background: var(--accent); color: var(--on-accent); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .n { background: var(--ok); color: var(--surface); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .n { background: var(--bad); color: var(--surface); }
.badge { flex: none; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-top: 2px; }
.badge.right { background: var(--ok); color: var(--surface); }
.badge.mine { background: var(--bad); color: var(--surface); }
.note { margin: 6px 4px 2px 44px; font-size: 0.9rem; color: var(--muted); white-space: pre-wrap; line-height: 1.65; }
.note b { color: var(--text); font-weight: 600; }
textarea.written {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px 14px;
  background: var(--surface); font-family: var(--mono); font-size: 0.9rem; resize: vertical; line-height: 1.6;
}
textarea.written:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea.written[readonly] { background: var(--surface-2); }

.verdict { margin-top: 16px; padding: 14px 16px; border-radius: 10px; }
.verdict.ok { background: var(--ok-soft); }
.verdict.no { background: var(--bad-soft); }
.verdict.skip, .verdict.solution { background: var(--surface-2); }
.verdict.answer { background: var(--ok-soft); }
.verdict.answer .title { color: var(--ok); }
.verdict .title { font-weight: 700; margin-bottom: 4px; }
.verdict.ok .title { color: var(--ok); }
.verdict.no .title { color: var(--bad); }
.verdict > p { margin: 4px 0; white-space: pre-wrap; }
.selfgrade { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.flag { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 0.92rem; }
details { margin-top: 10px; font-size: 0.92rem; }
details summary { cursor: pointer; color: var(--muted); }
details summary:hover { color: var(--text); }
details p { margin: 6px 0; }
details > p { white-space: pre-wrap; }
details.more .md { margin-top: 6px; }
.refs { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }

.summary { margin: 16px 0; }
.summary h2 { margin-top: 0; }
.summary > p { margin: 12px 0 4px; }
.score { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.wronglist { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
dialog.choose {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgb(0 0 0 / .2);
}
dialog.choose::backdrop { background: rgb(0 0 0 / .45); }
dialog.choose h2 { margin: 0 0 6px; }
.choose-btns { display: grid; gap: 8px; margin-top: 16px; }
.choose-btns .btn { padding: 10px 14px; }

@media (max-width: 640px) {
  main { padding: 18px 14px 96px; }
  h1 { font-size: 1.35rem; }
  h2 { margin-top: 30px; }
  .card { padding: 14px; }
  .q { padding: 16px 14px; }
  .form-row > .label { width: 100%; margin-bottom: -2px; }
  .note { margin-left: 4px; }
  .opt { padding: 12px; gap: 10px; }
  .quick { gap: 8px; }
  .tile { padding: 12px; }
  .tile-v { font-size: 1.35rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bar:has(.progress) { flex-basis: 100%; order: 3; }
  .bar:has(.progress) ~ .themebtn { margin-left: auto; }

  /* 시험 풀이 중에는 응답 현황과 버튼을 화면 아래에 둔다(엄지로 누르기 쉽게) */
  .topbar:has(.bar.dock) { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .bar.dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    flex-wrap: nowrap; gap: 10px;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgb(0 0 0 / .06);
  }
  .bar.dock .progress { min-width: 0; flex-direction: column-reverse; align-items: stretch; gap: 4px; }
  .bar.dock .progress .track { flex: none; }
  .bar.dock .btn.small { padding: 8px 12px; font-size: 0.9rem; }
  body:has(.bar.dock) main { padding-bottom: 120px; }

  /* 표는 줄마다 카드처럼 쌓는다 */
  table.stack thead { display: none; }
  table.stack, .stack tbody, .stack td { display: block; }
  .stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .stack tr:last-child { border-bottom: 0; }
  .stack td, .stack tr:last-child td { border: 0; padding: 0; white-space: normal; min-width: 0; }
  .stack td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font-size: 0.8rem; }
  .stack td.lead { grid-column: 1 / -1; font-weight: 600; }
  .stack td.wide { grid-column: 1 / -1; }
  .stack td.rowbtns { grid-column: 1 / -1; display: flex; justify-content: flex-start; text-align: left; margin-top: 6px; }
  .stack td.rowbtns > * { margin: 0; }
  .stack td:empty { display: none; }
}
@media (max-width: 380px) {
  .quick .tile .small { display: none; }
}

/* 보기를 섞었을 때 채점 후 보이는 원래 번호 */
.opt .orig { flex: none; font-size: 0.72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; margin-top: 3px; white-space: nowrap; }

/* 모의시험 */
.mockcard { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text); }
.mockcard > div { flex: 1; min-width: 0; }
.mockcard .wkstats { margin-top: 6px; }
.mockcard .go { flex: none; font-weight: 600; color: var(--accent); white-space: nowrap; }
.form-row[hidden] { display: none; }
.pick { display: inline-flex; align-items: center; gap: 6px; font-size: 0.92rem; color: var(--muted); }
.pick select { color: var(--text); }
.plan { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.alloc { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin: 6px 0; }
.alloc-cell { display: flex; flex-direction: column; align-items: center; padding: 8px 6px; border-radius: 9px; background: var(--surface-2); line-height: 1.3; font-variant-numeric: tabular-nums; }
.alloc-cell b { font-size: 1.1rem; }
.alloc-cell span { font-size: 0.78rem; color: var(--muted); }
.alloc-cell small { font-size: 0.72rem; color: var(--accent); }
.alloc-cell.short { background: var(--warn-soft); }
.alloc-cell.low { background: var(--bad-soft); }
.alloc-cell.low b { color: var(--bad); }
.plan-sum { margin: 8px 0 0; }
.warnline { color: var(--warn); margin: 6px 0 0; }
@media (max-width: 640px) {
  .mockcard { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* 사용자: 상단의 지금 사용자, 고르기 화면 */
.who {
  font-size: 0.8rem; font-weight: 600; text-decoration: none; color: var(--accent); white-space: nowrap;
  max-width: 9em; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; background: var(--surface);
}
.who:hover { border-color: var(--accent); }
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 16px 0 8px; }
.usercard { display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; padding: 14px 16px; }
.usercard:hover { border-color: var(--accent); }
.usercard.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.usercard .avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.usercard .uinfo { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.usercard .uname { font-weight: 600; overflow-wrap: anywhere; }
.textin { flex: 1; min-width: 0; max-width: 280px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 6px 10px; background: var(--surface); }
@media (max-width: 640px) {
  .sync:not(.error) { font-size: 0; } /* 좁은 화면에서는 저장 상태를 점으로만 보인다(실패는 글로) */
  .sync:not(.error)::before { margin-right: 0; }
}
