* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", sans-serif; height: 100vh; display: flex; flex-direction: column; background: #fafafa; }
header { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; height: 48px; background: #1a202c; color: #fff; }
header h1 { margin: 0; font-size: 16px; font-weight: 500; }
header nav { display: flex; gap: 8px; align-items: center; }
header button, header a { background: transparent; border: 1px solid #4a5568; color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 13px; cursor: pointer; text-decoration: none; line-height: 1.4; }
header button:hover, header a:hover { background: #2d3748; }
main { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #e2e8f0; min-height: 0; }
.editor, .preview { background: #fff; display: flex; flex-direction: column; overflow: hidden; }
#src { flex: 1; border: none; outline: none; padding: 16px; font: 14px/1.6 "SF Mono", monospace; resize: none; }
.status { padding: 4px 16px; font-size: 12px; color: #718096; border-top: 1px solid #e2e8f0; background: #f7fafc; }
.status.error { color: #c53030; background: #fed7d7; }
.status.busy { color: #2b6cb0; }
#preview { flex: 1; border: none; width: 100%; background: #fff; }
dialog { padding: 24px; max-width: 480px; border-radius: 8px; border: 1px solid #e2e8f0; }
dialog h2 { margin-top: 0; }
dialog ul { padding-left: 1.25rem; list-style: none; padding-left: 0; }
dialog li { cursor: pointer; padding: 8px 0; color: #2b6cb0; }
dialog li:hover { text-decoration: underline; }
dialog label { display: block; margin: 12px 0; }
dialog input { padding: 6px 10px; font-size: 14px; }
@media (max-width: 768px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}
.floating-menu {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 220px;
  font: 13px/1.5 -apple-system, "PingFang SC", sans-serif;
}
.floating-menu .item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f3f5;
}
.floating-menu .item:last-child { border-bottom: none; }
.floating-menu .item.active { background: #ebf4ff; }
.floating-menu .item strong { display: block; font-weight: 500; }
.floating-menu .item .desc { color: #718096; font-size: 12px; margin-top: 2px; }
