/* 분할 작업대(문제 화면) 스타일. 칸 나눔은 화면 폭에 따라 셋이다(bench.js와 같은 기준 900px·1280px):
     좁게(휴대폰)       위에서 아래로 문제 → 내 칸 → 아래 시트(탭)
     가운데(900px~)     왼쪽에 문제·내 칸, 오른쪽에 시트가 옆 칸으로
     넓게(1280px~, PC)  문제(+논점·자료) | 내 목차·풀이 | 모범 골격·채점(자주 틀림·계산기) 세 칸 + 아래 띠(근거·산식 꼴·메모) */
body.is-bench { overflow: hidden; }
body.is-bench .app { height: 100vh; height: 100dvh; min-height: 0; }
body.is-bench .work { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.is-bench main { min-height: 0; }
.bench { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.bench .tb { position: static; min-height: 46px; gap: 6px; }
.tb-id { flex: none; font-weight: 700; white-space: nowrap; }
.tb-ttl { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; color: var(--zz-ink-2); }
.save { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--zz-ink-2); white-space: nowrap; }
.save b { color: var(--zz-ok); font-size: 9px; }
.save[data-state="wait"] b { color: var(--zz-line-strong); }
.save[data-state="bad"], .save[data-state="bad"] b { color: var(--zz-danger); }
.tb .t { flex: none; min-height: 36px; font-family: var(--zz-mono); font-variant-numeric: tabular-nums; background: var(--zz-surface-2); border: 1px solid var(--zz-line); border-radius: 6px; padding: 0 8px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tb .t.over { color: var(--zz-warn); border-color: var(--zz-warn); background: var(--zz-warn-soft); }
@media (max-width: 479.98px) { .tb-ttl { display: none; } .save span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }

/* 진행 줄(논술) */
.stages { flex: none; display: flex; gap: 4px; padding: 5px 8px; background: var(--zz-surface); border-bottom: 1px solid var(--zz-line); }
.stages li { flex: 1 1 0; min-width: 0; display: flex; }
.stages button { flex: 1 1 auto; min-width: 0; min-height: 34px; border: 1px solid var(--zz-line); border-radius: 999px; background: var(--zz-surface-2); font-size: 13px; font-weight: 600; color: var(--zz-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.stages button b { font-family: var(--zz-mono); }
.stages button.done { color: var(--zz-ok); border-color: var(--zz-ok); background: var(--zz-ok-soft); }
.stages li { max-width: 260px; }
.stages button[aria-current="step"] { background: var(--zz-accent); border-color: var(--zz-accent); color: var(--zz-on-accent); }

/* 칸 */
.bench-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pane { background: var(--zz-surface); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-h { flex: none; margin: 0; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; min-height: 36px; font-size: 12px; letter-spacing: .06em; color: var(--zz-ink-2); background: var(--zz-surface-2); border-bottom: 1px solid var(--zz-line); font-weight: 700; }
.pane-h .r { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; letter-spacing: 0; font-weight: 500; min-width: 0; white-space: nowrap; padding-right: 8px; }
.pane-h .src { overflow: hidden; text-overflow: ellipsis; }
.pane-btn { min-height: 32px; border: 1px solid transparent; background: none; color: var(--zz-ink-2); font-size: 12.5px; font-weight: 600; padding: 0 8px; border-radius: 6px; }
.pane-btn:hover { background: var(--zz-surface); border-color: var(--zz-line); }
.pane-btn[aria-pressed="true"] { background: var(--zz-accent-soft); color: var(--zz-accent); }
.only-wide, .only-side { display: none; }
.pane .in { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 12px; font-size: var(--zz-read); line-height: 1.7; }
.pane .in p + p { margin-top: 6px; }
.parts { list-style: decimal; padding-left: 22px; margin-top: 6px; }
.p-q { flex: 0 0 28%; }
.bench[data-kind="calc"] .bench-body:not(.has-qh) > .p-q:not(.is-shut) { flex-basis: 22%; }
.has-qh > .p-q { flex-basis: var(--q-h); }
.p-q.is-shut { flex-basis: 37px; }
.p-q.is-shut .in { display: none; }
.p-main { flex: 1 1 0; min-height: 96px; }
.grip { flex: none; height: 14px; background: var(--zz-bg); border-top: 1px solid var(--zz-line); border-bottom: 1px solid var(--zz-line); display: grid; place-items: center; cursor: row-resize; touch-action: none; }
.grip::after { content: ""; width: 34px; height: 3px; border-radius: 2px; background: var(--zz-line-strong); }
.grip:focus-visible { outline-offset: -2px; }
.ed { flex: 1 1 auto; min-height: 0; width: 100%; border: 0; border-radius: 0; background-color: var(--zz-surface); padding: 8px 12px 8px 38px; font-size: max(16px, var(--zz-read)); line-height: 28px; resize: none;
  background-image: linear-gradient(90deg, var(--zz-surface-2) 28px, var(--zz-line) 28px, var(--zz-line) 29px, transparent 29px); }
.ed.plain { padding-left: 14px; background-image: none; }
.ed:focus-visible { outline-offset: -2px; }
.acts { flex: none; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 6px 10px; border-top: 1px solid var(--zz-line); background: var(--zz-surface); }
.acts .hint { flex: 1 1 140px; min-width: 0; font-size: 12.5px; color: var(--zz-ink-2); }
.acts .sp { display: none; }
.acts .btn { min-height: 40px; }
.acts.in-list { border-top: 0; padding: 14px 0 4px; background: none; }

/* 아래 시트 */
.sheet { flex: 0 0 38%; background: var(--zz-surface); border-radius: 14px 14px 0 0; box-shadow: var(--zz-shadow-sheet); display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; z-index: 2; }
.sheet[data-size="min"] { flex-basis: 61px; }
.sheet[data-size="max"] { flex-basis: 72%; }
.sheet[data-size="free"] { flex-basis: var(--sheet-h, 40%); }
.sheet[data-size="min"] .panels { display: none; }
.sheet-grab { flex: none; width: 100%; height: 18px; border: 0; background: none; display: grid; place-items: center; touch-action: none; cursor: row-resize; border-radius: 14px 14px 0 0; }
.sheet-grab::after { content: ""; width: 38px; height: 4px; border-radius: 2px; background: var(--zz-line-strong); }
.tabs { flex: none; display: flex; gap: 2px; padding: 0 6px; border-bottom: 1px solid var(--zz-line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 42px; padding: 0 10px; border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--zz-ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--zz-accent); border-color: var(--zz-accent); }
.tabs button:focus-visible { outline-offset: -3px; }
.panels { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.panel { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--zz-surface); }
.panel-in { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 12px 14px; font-size: var(--zz-read-s); line-height: 1.6; }
.panel-lead { color: var(--zz-ink-2); margin-bottom: 8px; }
.fine { font-size: 12.5px; color: var(--zz-ink-2); margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.locked { background: var(--zz-surface-2); border: 1px dashed var(--zz-line-strong); border-radius: var(--zz-radius-m); padding: 12px; color: var(--zz-ink-2); }
.locked .btn { margin-top: 8px; }

/* 논점 뽑기 */
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--zz-line-strong); background: var(--zz-surface); font-weight: 600; font-size: 14px; }
.pick[aria-pressed="true"] { background: var(--zz-accent); border-color: var(--zz-accent); color: var(--zz-on-accent); }
.pick[aria-disabled="true"] { cursor: default; }
.pick.hit { background: var(--zz-ok-soft); border-color: var(--zz-ok); color: var(--zz-ok); }
.pick.hit::before { content: "✓ "; }
.pick.missed { background: var(--zz-warn-soft); border: 1px dashed var(--zz-warn); color: var(--zz-warn); }
.pick.missed::after { content: " · 빠뜨림"; font-weight: 500; }
.pick.wrong { background: var(--zz-danger-soft); border-color: var(--zz-danger); color: var(--zz-danger); text-decoration: line-through; }
.pick-note { font-size: 13px; color: var(--zz-ink-2); }

/* 모범 골격, 채점 포인트, 근거, 메모 */
.sk li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 6px 0; border-bottom: 1px dashed var(--zz-line); }
.sk li.s { padding-left: 14px; color: var(--zz-ink-2); border-bottom: 0; padding-top: 2px; padding-bottom: 2px; }
.sk li.say { font-size: .94em; padding-bottom: 6px; border-bottom: 1px dashed var(--zz-line); }
.sk li.say span::before { content: "꼭 들어갈 말 · "; font-weight: 600; }
.sk li em { font-style: normal; font-family: var(--zz-mono); font-size: 12.5px; color: var(--zz-accent); }
.sk li.miss { background: var(--zz-warn-soft); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.sk li.miss em, .miss-tag { color: var(--zz-warn); }
.miss-tag { font-size: .9em; font-weight: 600; white-space: nowrap; }
.prev { margin-top: 10px; }
.prev summary { cursor: pointer; min-height: 36px; font-weight: 600; }
.prev pre { margin: 4px 0 0; white-space: pre-wrap; font: inherit; color: var(--zz-ink-2); background: var(--zz-surface-2); border-radius: var(--zz-radius-s); padding: 8px 10px; }
.ck label { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--zz-line); min-height: 44px; cursor: pointer; }
.ck input { width: 20px; height: 20px; accent-color: var(--zz-accent); margin: 0; flex: none; }
.ck .ck-t { flex: 1 1 auto; min-width: 0; }
.ck .n { flex: none; font-size: 12.5px; color: var(--zz-ink-2); }
.tot { display: flex; padding-top: 10px; font-weight: 700; }
.law p { margin-bottom: 8px; }
.law p b { display: block; color: var(--zz-accent); font-size: .94em; }
.law p b .chip { margin-right: 2px; }
.memo-wrap { display: flex; flex-direction: column; }
.memo { flex: 1 1 auto; width: 100%; min-height: 84px; border: 1px solid var(--zz-line-strong); border-radius: var(--zz-radius-m); background: var(--zz-surface-2); padding: 8px 10px; font-size: max(16px, var(--zz-read-s)); line-height: 1.6; resize: none; }

/* 계산 단계 */
.steps { padding-top: 4px; }
.stp { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--zz-line); }
.stp > i { font-style: normal; width: 24px; height: 24px; border-radius: 6px; background: var(--zz-accent-soft); color: var(--zz-accent); display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px; }
.stp.is-ok > i { background: var(--zz-ok-soft); color: var(--zz-ok); }
.stp.is-bad > i { background: var(--zz-danger-soft); color: var(--zz-danger); }
.stp.is-shown > i { background: var(--zz-warn-soft); color: var(--zz-warn); }
.stp b { font-size: var(--zz-read); }
.stp .f { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--zz-read-s); color: var(--zz-ink-2); }
.stp input { flex: 1 1 120px; width: 120px; max-width: 200px; min-width: 0; min-height: 40px; border: 1px solid var(--zz-line-strong); border-radius: 6px; background: var(--zz-surface-2); color: var(--zz-ink); text-align: right; padding: 0 8px; font-family: var(--zz-mono); font-size: 16px; }
.stp.is-ok input { border-color: var(--zz-ok); }
.stp.is-bad input { border-color: var(--zz-danger); }
.stp .f .btn { min-height: 40px; }
.stp .mark { font-weight: 600; }
.stp.is-ok .mark { color: var(--zz-ok); }
.stp.is-bad .mark { color: var(--zz-danger); }
.stp.is-shown .mark { color: var(--zz-warn); }
.stp .why { margin-top: 6px; font-size: var(--zz-read-s); background: var(--zz-surface-2); border-left: 3px solid var(--zz-line-strong); padding: 6px 8px; border-radius: 0 6px 6px 0; color: var(--zz-ink-2); }
.stp.tot { border-top: 2px solid var(--zz-ink); border-bottom: 0; padding-top: 10px; display: grid; }
.stp.tot output { font-size: 18px; font-weight: 700; color: var(--zz-accent); }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dchip { min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--zz-line-strong); background: var(--zz-surface); font-size: 13px; font-weight: 600; }
.dchip[aria-pressed="true"] { background: var(--zz-accent-soft); border-color: var(--zz-accent); color: var(--zz-accent); }
.dbox + .dbox { margin-top: 12px; }
.dt { width: 100%; border-collapse: collapse; }
.dt caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.dt th, .dt td { padding: 6px; border-bottom: 1px solid var(--zz-line); text-align: left; vertical-align: top; }
.dt th { color: var(--zz-ink-2); font-weight: 600; width: 38%; }
.dt td { font-variant-numeric: tabular-nums; }
.dt tr.hl th, .dt tr.hl td { background: var(--zz-accent-soft); }
.traps { list-style: disc; padding-left: 18px; }
.traps li { margin-bottom: 6px; }
.form { background: var(--zz-surface-2); border-radius: var(--zz-radius-s); padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; }
.ans { list-style: decimal; padding-left: 22px; margin-top: 8px; }
.ans li { margin-bottom: 3px; }
.ans .ans-tot { list-style: none; margin-left: -22px; padding-top: 4px; border-top: 1px solid var(--zz-line); font-weight: 700; }

/* 계산기 */
.pad { display: flex; flex-direction: column; gap: 6px; max-width: 420px; margin: 0 auto; }
.pad-log { display: flex; flex-direction: column; gap: 2px; }
.pad-line { min-height: 32px; border: 0; background: none; text-align: right; font-size: 12.5px; color: var(--zz-ink-2); padding: 0 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-line:hover { background: var(--zz-surface-2); }
.pad-disp { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-height: 52px; justify-content: center; background: var(--zz-surface-2); border: 1px solid var(--zz-line); border-radius: var(--zz-radius-m); padding: 6px 10px; }
.pad-expr { font-size: 20px; font-weight: 700; max-width: 100%; overflow-x: auto; white-space: nowrap; }
.pad-note { font-size: 12px; color: var(--zz-warn); }
.pad-note:empty { display: none; }
.pad-keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.pad-key { min-height: 44px; border: 1px solid var(--zz-line); border-radius: var(--zz-radius-m); background: var(--zz-surface); font-size: 17px; font-weight: 600; font-family: var(--zz-mono); padding: 0; }
.pad-key:active { background: var(--zz-accent-soft); }
.pad-key.op { background: var(--zz-surface-2); color: var(--zz-accent); }
.pad-key.fn { background: var(--zz-surface-2); font-family: var(--zz-font); font-size: 13.5px; }
.pad-key.put { background: var(--zz-accent-soft); color: var(--zz-accent); border-color: var(--zz-accent); }
.pad-key.wide { grid-column: span 2; }
.pad-key.eq { background: var(--zz-accent); border-color: var(--zz-accent); color: var(--zz-on-accent); }

/* ---------- 가운데 폭(900px~): 시트가 오른쪽 옆 칸으로 ---------- */
@media (min-width: 900px) {
  .only-side { display: inline-flex; }
  .bench-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 40%); grid-template-rows: minmax(0, 2fr) 14px minmax(0, 3fr); }
  .bench-body.has-qh { grid-template-rows: var(--q-h) 14px minmax(0, 1fr); }
  .bench[data-kind="calc"] .bench-body:not(.has-qh) { grid-template-rows: minmax(0, 1fr) 14px minmax(0, 3fr); }
  .p-q { grid-column: 1; grid-row: 1; }
  .p-q.is-shut { align-self: start; }
  .grip { grid-column: 1; grid-row: 2; }
  .p-main { grid-column: 1; grid-row: 3; }
  .sheet { grid-column: 2; grid-row: 1 / -1; border-radius: 0; box-shadow: none; border-left: 1px solid var(--zz-line); }
  .sheet-grab { display: none; }
  .sheet[data-size="min"] .panels { display: flex; }
  .tabs { padding-top: 2px; }
  .acts .sp { display: block; flex: 0 0 0; }
}

/* ---------- 넓게(1280px~, PC): 세 칸 + 아래 띠 ---------- */
@media (min-width: 1280px) {
  .only-wide { display: flex; }
  .bench-body, .bench-body.has-qh, .bench[data-kind="calc"] .bench-body:not(.has-qh) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: minmax(0, 3fr) minmax(0, 2fr) auto auto; gap: 1px; background: var(--zz-line); }
  .bench[data-kind="calc"] .bench-body, .bench[data-kind="calc"] .bench-body.has-qh, .bench[data-kind="calc"] .bench-body:not(.has-qh) { grid-template-rows: minmax(0, 1fr) minmax(0, 2fr) auto auto; }
  .grip { display: none; }
  .sheet, .panels { display: contents; }
  .p-q { grid-column: 1; grid-row: 1; }
  .p-q.is-shut { align-self: stretch; }
  .p-q.is-shut .in { display: block; }
  #q-shut { display: none; }
  .p-main { grid-column: 2; grid-row: 1 / 3; }
  .panel[data-slot="left"] { grid-column: 1; grid-row: 2; }
  .panel[data-slot="right1"] { grid-column: 3; grid-row: 1; }
  .panel[data-slot="right2"] { grid-column: 3; grid-row: 2; }
  .tabs { grid-column: 1 / -1; grid-row: 3; background: var(--zz-surface-2); border-bottom: 0; padding: 0 8px; }
  .tabs button { min-height: 38px; }
  .panel[data-slot="bottom"] { grid-column: 1 / -1; grid-row: 4; height: 132px; }
  .panel[data-slot="bottom"] > .pane-h { display: none; }
  .sheet[data-size="min"] .panel[data-slot="bottom"] { display: none; }
  .sheet[data-size="max"] .panel[data-slot="bottom"] { height: 260px; }
  .panel[data-slot="bottom"] .law { columns: 2 380px; column-gap: 28px; }
  .panel[data-slot="bottom"] .law > * { break-inside: avoid; }
  .panel[data-slot="bottom"] .memo { min-height: 0; height: 100%; }
  .ed { padding-top: 12px; }
}
