.editor { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.editor-topbar { height: 56px; padding: 0 var(--space-4) 0 var(--space-5); }
.editor-topbar .brand-mark { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.editor-topbar .brand-name { font-size: var(--font-md); }
.divider { width: 1px; height: 20px; background: var(--color-border); flex-shrink: 0; }
.exam-title { font-size: 15px; font-weight: 600; min-width: 0; max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-status { font-size: 13px; color: var(--color-text-3); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-status.saved { color: var(--color-success); }
.save-status.failed { color: var(--color-danger); }
.guest-banner { border-radius: 0; justify-content: center; height: 44px; flex-shrink: 0; padding: 0 var(--space-4); }

.editor-body { flex: 1; min-height: 0; display: flex; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--color-surface); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; overflow-y: auto; }
.sidebar-head { height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-3) 0 var(--space-5); }
.sidebar-head h2 { margin: 0; font-size: 15px; }
.btn-mini { height: 32px; padding: 0 10px; border-radius: var(--radius-sm); background: var(--color-primary-weak); font-size: 13px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.exam-list { list-style: none; margin: 0; padding: 0 var(--space-2) var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.exam-item { display: flex; flex-direction: column; gap: 2px; padding: 10px var(--space-3); border-radius: var(--radius-sm); text-decoration: none; color: var(--color-text); min-width: 0; }
a.exam-item:hover { background: var(--color-bg); color: var(--color-text); }
.exam-item.current { background: var(--color-primary-weak); }
.exam-item.current .exam-item-title { color: var(--color-primary-pressed); font-weight: 600; }
.exam-item.disabled { color: var(--color-text-3); }
.exam-item-title { font-size: var(--font-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-item-meta { font-size: var(--font-xs); color: var(--color-text-3); }
.sidebar-empty { padding: var(--space-7) var(--space-5); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); color: var(--color-text-2); }
.sidebar-empty svg { color: var(--color-text-disabled); }

.panel { width: 320px; flex-shrink: 0; background: var(--color-surface); border-right: 1px solid var(--color-border); overflow-y: auto; padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-6); }
.panel section { display: flex; flex-direction: column; gap: var(--space-3); }
.panel h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel hr { border: none; height: 1px; background: var(--color-border); margin: 0; flex-shrink: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.checks { display: flex; flex-direction: column; gap: 2px; }
.check { min-height: 32px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--color-primary); }
.check.answers { min-height: 40px; margin-top: var(--space-1); padding: 0 10px; border-radius: var(--radius-sm); background: var(--color-danger-weak); color: var(--color-danger); font-weight: 600; }
.check.answers input { accent-color: var(--color-danger); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; background: var(--color-bg); border-radius: var(--radius-sm); }
.seg button { height: 34px; border: none; border-radius: 5px; background: transparent; color: var(--color-text-2); cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-primary); font-weight: 600; box-shadow: var(--shadow-card); }
.tool-btn { height: 40px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); cursor: pointer; font-size: var(--font-sm); }
.tool-btn:hover { border-color: var(--color-border-strong); }
.tool-btn.plain { border-color: transparent; background: transparent; color: var(--color-text-2); }
.tips { background: var(--color-bg); border-radius: var(--radius-md); padding: var(--space-3) 14px; display: flex; flex-direction: column; gap: var(--space-1); font-size: 13px; line-height: 20px; color: var(--color-text-2); flex-shrink: 0; }
.tips strong { color: var(--color-text); }

.preview { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--color-border); }
.preview-bar { height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-5); font-size: 13px; color: var(--color-text-2); }
.preview-bar label { display: flex; align-items: center; gap: var(--space-2); }
.input-sm { height: 32px; font-size: 13px; }
.overflow-banner { margin: 0 var(--space-5) var(--space-3); }
.welcome { flex: 1; display: flex; align-items: center; justify-content: center; padding-bottom: var(--space-8); }
.welcome-card { width: 440px; padding: 36px; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; }
.welcome-icon { width: 56px; height: 56px; border-radius: var(--radius-pill); background: var(--color-primary-weak); color: var(--color-primary); display: flex; align-items: center; justify-content: center; }
.welcome-card h2 { margin: 0; font-size: 20px; }
.welcome-card p { margin: 0; color: var(--color-text-2); line-height: 22px; }
.welcome-actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }
#engine { flex: 1; min-height: 0; width: 100%; border: none; background: transparent; }

.dialog-wide { width: 640px; }
.paste-input { width: 100%; height: 320px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; background: var(--color-surface); }

@media (max-width: 1366px) { .exam-title { max-width: 240px; } }

.mobile-tip { display: none; }

@media (max-width: 768px) {
  .editor { height: auto; min-height: 100vh; overflow: visible; }
  .editor-topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: var(--space-2) var(--space-4); row-gap: var(--space-2); }
  .editor-topbar .brand-name, .editor-topbar .divider, .editor-topbar .spacer { display: none; }
  .exam-title { order: 2; flex: 1 1 100%; max-width: none; }
  .editor-topbar .account { order: 1; margin-left: auto; }
  .save-status, .editor-topbar .btn { order: 3; }
  .save-status { margin-right: auto; }
  .guest-banner { height: auto; min-height: 44px; flex-wrap: wrap; padding: var(--space-2) var(--space-4); justify-content: center; text-align: center; }
  .mobile-tip { display: block; margin: 0; padding: var(--space-3) var(--space-4); background: var(--color-primary-weak); color: var(--color-text); font-size: var(--font-sm); line-height: 20px; }

  .editor-body { flex: none; flex-direction: column; min-height: 0; }
  .sidebar { order: 0; width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid var(--color-border); }
  .preview { order: 1; flex: none; min-height: 70vh; }
  .panel { order: 2; width: 100%; overflow-y: visible; border-right: none; border-top: 1px solid var(--color-border); padding: var(--space-4); }
  #engine { flex: none; height: 70vh; min-height: 420px; }
  .preview-bar { height: auto; min-height: 48px; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-4); }
  .overflow-banner { margin: 0 var(--space-4) var(--space-3); }
  .welcome { padding: var(--space-6) var(--space-4); }
  .welcome-card { width: 100%; padding: var(--space-6) var(--space-4); }
  .welcome-actions { flex-direction: column; align-self: stretch; }
  .welcome-actions .btn { width: 100%; }
  .exam-item { min-height: 44px; justify-content: center; }
  .btn-mini { height: 44px; }
  .seg button { height: 44px; }
  .check { min-height: 44px; }
  .tool-btn { height: 44px; }
  .paste-input { height: 200px; }
}
