.essay-bank-v2 { padding-bottom: 20px; }
.essay-filter-v2 { margin-top: 0; }

.essay-paper-shell { width: min(1480px, calc(100% - 48px)); padding-top: 28px; padding-bottom: 72px; }
.essay-breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8125rem; }
.essay-breadcrumb a { color: var(--primary); }
.essay-paper-head { padding: 28px 0 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.essay-paper-head h1 { max-width: 1050px; margin: 8px 0 12px; font-size: clamp(1.75rem, 3vw, 2.75rem); line-height: 1.22; letter-spacing: -.025em; }
.essay-paper-head p { margin: 0; color: var(--muted); font-size: .875rem; }
.essay-paper-loading { min-height: 320px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--muted); }
.essay-paper-loading[hidden] { display: none; }
.essay-access-gate { max-width: 680px; margin: 60px auto; padding: 44px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.essay-access-gate[hidden] { display: none; }
.essay-access-gate > span { color: var(--purple); font-size: .8125rem; font-weight: 850; }
.essay-access-gate h2 { margin: 10px 0; font-size: 1.6rem; }
.essay-access-gate p { margin: 0; color: var(--text-2); line-height: 1.75; }
.essay-access-gate > div { margin-top: 24px; display: flex; justify-content: center; gap: 10px; }
.essay-paper-workspace { display: grid; gap: 18px; }
.essay-paper-workspace[hidden] { display: none; }
.essay-sheet { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 30px rgba(40, 73, 126, .045); }
.essay-sheet > header { min-height: 66px; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.essay-sheet > header > div { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.essay-sheet > header > div i, .essay-draft-v2 h2 i { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: var(--primary); }
.essay-question-sheet > header > div i { background: #f59e0b; }
.essay-sheet > header nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 12px; background: var(--bg-soft); }
.essay-sheet > header button { min-width: 74px; height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-weight: 750; }
.essay-sheet > header button:hover, .essay-sheet > header button.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 9px rgba(25, 56, 104, .08); }
.essay-reading { max-height: min(70vh, 780px); padding: 30px clamp(22px, 3vw, 44px); overflow-y: auto; scroll-behavior: smooth; scrollbar-gutter: stable; }
.essay-reading p { width: 100%; max-width: none; margin: 0 0 1.15em; color: var(--text-2); font-size: 1rem; line-height: 1.95; text-indent: 2em; text-align: justify; text-justify: inter-ideograph; overflow-wrap: anywhere; word-break: normal; }
.essay-reading p:last-child { margin-bottom: 0; }
.essay-figures { width: 100%; margin: 22px 0 4px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.essay-figures figure { min-width: 0; margin: 0; }
.essay-figures figure > button { width: 100%; min-height: 170px; padding: 12px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); cursor: zoom-in; }
.essay-figures figure > button:hover { border-color: var(--primary); background: var(--primary-soft); }
.essay-figures img { display: block; max-width: 100%; max-height: 560px; object-fit: contain; border-radius: 8px; }
.essay-figures figcaption { margin-top: 7px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .75rem; }
.essay-figures figcaption small { font: inherit; white-space: nowrap; }
.essay-image-error { color: var(--muted); font-size: .875rem; }
.essay-image-viewer { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 28px; }
.essay-image-viewer-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(8, 15, 27, .78); backdrop-filter: blur(5px); }
.essay-image-viewer section { position: relative; z-index: 1; max-width: min(1180px, 94vw); max-height: 92vh; padding: 18px; overflow: auto; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 80px rgba(0, 0, 0, .35); }
.essay-image-viewer section img { display: block; max-width: 100%; max-height: calc(92vh - 36px); object-fit: contain; }
.essay-image-viewer-close { position: sticky; top: 0; float: right; z-index: 2; width: 36px; height: 36px; margin: 0 0 -36px; border: 0; border-radius: 50%; background: rgba(17, 24, 39, .78); color: #fff; font-size: 1.5rem; line-height: 1; }
.essay-question { padding: 25px clamp(22px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.essay-question > span { display: inline-flex; padding: 5px 10px; border-radius: 999px; background: #fff5df; color: #a85d00; font-size: .75rem; font-weight: 800; }
[data-theme="dark"] .essay-question > span { background: rgba(245, 158, 11, .12); color: #fbbf55; }
.essay-question p { margin: 12px 0 0; color: var(--text); font-size: 1rem; line-height: 1.9; }
.essay-draft-v2 { padding: 24px clamp(22px, 4vw, 44px); }
.essay-draft-v2 h2 { margin: 0 0 14px; display: flex; align-items: center; gap: 9px; font-size: 1rem; }
.essay-draft-v2 textarea { width: 100%; min-height: 230px; resize: vertical; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--text); font: inherit; line-height: 1.8; transition: border-color .18s, box-shadow .18s; }
.essay-draft-v2 textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.essay-draft-v2 textarea.needs-answer { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.essay-draft-v2 footer { margin-top: 12px; display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
.essay-draft-v2 footer span { color: var(--muted); font-size: .7812rem; }
.essay-reference { margin: 0 clamp(22px, 4vw, 44px) 32px; padding: 24px; border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--green-soft) 55%, var(--surface)); }
.essay-reference[hidden] { display: none; }
.essay-reference h2 { margin: 0 0 12px; font-size: 1.05rem; }
.essay-reference article p { margin: 0 0 1em; color: var(--text); line-height: 1.9; }
.essay-reference > p { margin: 14px 0 0; color: var(--muted); font-size: .75rem; }

@media (max-width: 760px) {
  .essay-paper-shell { width: min(100% - 24px, 1480px); padding-top: 16px; }
  .essay-paper-head { padding-top: 20px; display: grid; }
  .essay-paper-head > a { display: none; }
  .essay-sheet > header { align-items: flex-start; flex-direction: column; }
  .essay-sheet > header nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .essay-reading { max-height: 68vh; padding: 22px 18px; scrollbar-gutter: auto; }
  .essay-reading p { font-size: .9375rem; }
  .essay-question, .essay-draft-v2 { padding: 20px 18px; }
  .essay-draft-v2 footer { align-items: stretch; flex-direction: column; }
  .essay-draft-v2 footer .button { width: 100%; }
  .essay-reference { margin: 0 18px 22px; padding: 18px; }
  .essay-filter-row label, .essay-filter-row select { width: 100%; }
  .essay-filter-row button { width: 100%; }
}
