:root {
  --ground: #f5f5f4;
  --paper: #fff;
  --ink: #191919;
  --muted: #626262;
  --border: #dededb;
  --border-strong: #bfbfba;
  --accent: #191919;
  --info: #245d74;
  --warning: #8a4b0e;
  --error: #9c2929;
  --focus: #245d74;
  --serif: "Noto Serif KR", Georgia, serif;
  --sans: "Apple SD Gothic Neo", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  word-break: keep-all;
}
button, input, textarea { font: inherit; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--info); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.shell { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: baseline; gap: 8px; color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-decoration: none; white-space: nowrap; }
.brand small { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .09em; }
.brand-divider { color: var(--border-strong); }
.nav { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.nav a { color: var(--muted); }

.page-header { padding: 62px 0 28px; max-width: 760px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; line-height: 1.4; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-family: var(--serif); font-size: clamp(32px, 5vw, 49px); font-weight: 500; letter-spacing: -.04em; line-height: 1.2; }
h2 { margin-bottom: 20px; font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -.025em; line-height: 1.35; }
h3 { margin-bottom: 14px; font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: -.025em; line-height: 1.4; }
.muted { color: var(--muted); }
.intro-copy { margin-bottom: 0; font-size: 17px; }

.notice {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(0, 2fr);
  gap: 32px;
  padding: 22px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--border);
}
.notice p:last-child { margin-bottom: 0; }
.notice.warning { border-color: #d7b585; color: #5c3307; background: #fff9f1; }
.notice.error { border-color: #d7a2a2; color: #6e1c1c; background: #fff7f7; }
.inline-notice { display: block; padding: 13px 15px; margin: 20px 0; font-size: 14px; }

.workspace { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 50px; padding: 42px 0 70px; }
.sidebar { align-self: start; position: sticky; top: 18px; padding-top: 3px; }
.sidebar-progress { margin: 0 0 17px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.question-list { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--border); }
.question-list li { border-bottom: 1px solid var(--border); }
.question-list a { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 5px 8px; padding: 12px 0; color: var(--ink); font-size: 13px; line-height: 1.4; text-decoration: none; }
.question-list a:hover { color: var(--info); }
.question-number, .answer-marker, .char-count, .question-meta { font-family: var(--mono); }
.question-number { color: var(--muted); font-size: 11px; }
.answer-marker { grid-column: 2; color: var(--muted); font-size: 10px; }
.answer-marker.is-answered { color: var(--info); }

.main-content { min-width: 0; }
.panel { margin-bottom: 26px; padding: 26px 28px; background: var(--paper); border: 1px solid var(--border); }
.panel > :last-child { margin-bottom: 0; }
.field { margin-top: 18px; }
.field-label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.field-help { margin-bottom: 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.input, .textarea, .file-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 11px 12px;
  line-height: 1.55;
}
.input { max-width: 430px; }
.textarea { display: block; min-height: 120px; resize: vertical; }
.textarea::placeholder, .input::placeholder { color: #858585; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--error); }
.field-error { margin: 8px 0 0; color: var(--error); font-size: 13px; font-weight: 700; }
.field-lower { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 8px; }
.field-lower .field-error { margin: 0; }
.char-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.compact-field { margin-top: 22px; }

.resource-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.radio-option { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); font-size: 14px; cursor: pointer; }
.radio-option input { flex: 0 0 auto; width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--accent); }

.question-section { scroll-margin-top: 20px; }
.section-title { margin-bottom: 4px; }
.question-section > .muted { margin-bottom: 22px; }
.question-card { scroll-margin-top: 20px; padding: 30px 0 34px; border-top: 1px solid var(--border); }
.question-card:last-child { border-bottom: 1px solid var(--border); }
.question-card .field { margin-top: 20px; }
.question-meta { margin-bottom: 8px; color: var(--info); font-size: 11px; font-weight: 700; letter-spacing: .07em; }
.question-prompt { margin-bottom: 9px; font-size: 16px; line-height: 1.8; }

.action-panel { margin-top: 30px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}
.button:hover { background: #373737; }
.button.secondary { background: var(--paper); color: var(--ink); }
.button.secondary:hover { background: #f0f0ed; }
.button.danger { margin-left: auto; border-color: #985454; background: var(--paper); color: #7b2424; }
.button.danger:hover { background: #fff5f5; }
.button:disabled, .button[aria-disabled="true"] { border-color: var(--border); background: #e8e8e5; color: #858580; cursor: not-allowed; }
.status { margin: 17px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
dd, .sidebar h2 { margin-inline-start: 0; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
[hidden] { display: none !important; }
.status.error { color: var(--error); font-weight: 700; }
.status.warning { color: var(--warning); font-weight: 700; }

.footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 36px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.footer p { margin: 0; }
.footer a { color: var(--muted); }

.empty-state { padding: 42px 20px; border: 1px dashed var(--border-strong); color: var(--muted); text-align: center; }
.file-input { padding: 9px; }
.grade-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 16px 0; border-top: 1px solid var(--border); }
.score-options { display: flex; flex-wrap: wrap; gap: 8px; }
.answer-text { padding: 14px; background: #f7f7f5; border-left: 2px solid var(--border-strong); white-space: pre-wrap; }
.feedback { width: 100%; min-height: 80px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .shell { padding: 0 24px; }
  .page-header { padding-top: 44px; }
  .notice { grid-template-columns: 1fr; gap: 10px; }
  .workspace { grid-template-columns: 1fr; gap: 30px; padding-top: 30px; }
  .sidebar { position: static; padding: 16px 0; border-bottom: 1px solid var(--border); }
  .question-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-list li:nth-child(odd) { border-right: 1px solid var(--border); padding-right: 12px; }
  .question-list li:nth-child(even) { padding-left: 12px; }
  .resource-options { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  body { font-size: 15px; }
  .shell { padding: 0 20px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 9px; padding: 17px 0; }
  .nav { gap: 14px; }
  .brand small { font-size: 9px; }
  .panel { padding: 22px 18px; margin-left: -1px; margin-right: -1px; }
  h1 { font-size: 34px; }
  h3 { font-size: 21px; }
  .question-list { grid-template-columns: 1fr; }
  .question-list li:nth-child(odd), .question-list li:nth-child(even) { border-right: 0; padding-left: 0; padding-right: 0; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .button, .button.danger { width: 100%; margin-left: 0; }
  .field-lower { flex-direction: column; gap: 6px; }
  .footer { align-items: flex-start; flex-direction: column; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .shell { max-width: none; padding: 0; }
  .topbar, .sidebar, .nav, .actions, .footer, .action-panel, .notice { display: none; }
  .page-header { padding: 0 0 18px; }
  .workspace { display: block; padding: 0; }
  .panel { padding: 0 0 18px; border: 0; }
  .question-card { break-inside: avoid; padding: 18px 0; }
  .textarea { min-height: 0; border: 0; padding: 0; resize: none; }
  .field-lower { display: none; }
}
