* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  padding: 24px;
}
header h1 {
  font-size: 18px;
  margin: 0 0 4px 0;
}
header .sub {
  color: #6e6e73;
  font-size: 12px;
  margin-bottom: 16px;
}
main { max-width: 1100px; margin: 0 auto; }

.editor textarea {
  width: 100%;
  min-height: 320px;
  padding: 14px;
  font: 13px/1.5 ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: #fff;
  resize: vertical;
  outline: none;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.editor textarea:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.15); }

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}
button {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid #d2d2d7;
  background: #fff;
  color: #1d1d1f;
  border-radius: 8px;
  cursor: pointer;
  transition: background .1s;
}
button:hover { background: #f0f0f3; }
button:active { background: #e5e5ea; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary {
  background: #0071e3;
  color: #fff;
  border-color: #0071e3;
}
button.primary:hover { background: #006ed1; }
.hint { color: #86868b; font-size: 12px; margin-left: auto; }

.status {
  padding: 4px 10px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.status-ok    { background: #e8f5e9; color: #1b5e20; }
.status-err   { background: #ffebee; color: #b71c1c; }
.status-warn  { background: #fff8e1; color: #6d4c00; }

.errors-wrap ul {
  margin: 0; padding: 0; list-style: none;
}
.errors-wrap li {
  padding: 4px 10px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  margin: 2px 0;
}
.err  { background: #ffebee; color: #b71c1c; }
.warn { background: #fff8e1; color: #6d4c00; }

.cheatsheet {
  margin-top: 20px;
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  padding: 0 14px;
}
.cheatsheet summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 500;
}
.cheatsheet pre {
}
.cheat-body p { margin: 6px 0; color: #1d1d1f; }
.cheat-body p + p { margin-top: 10px; }
.cheat-body code { background: #fff; padding: 1px 6px; border: 1px solid #e0e0e3; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 12px; }

footer {
  max-width: 1100px;
  margin: 28px auto 0;
  padding-top: 16px;
  border-top: 1px solid #e5e5ea;
}
.footer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.footer-bar {
  padding-bottom: 8px;
}
.footer-help {
  font-size: 13px;
}
.footer-help a {
  color: #0071e3;
  text-decoration: none;
  margin-right: 12px;
}
.footer-help a:hover { text-decoration: underline; }
.footer-btn {
  font-size: 12px;
  padding: 5px 12px;
}
.footer-log {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  padding: 0 14px;
}
.footer-log summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 500;
  font-size: 13px;
}
.log-list {
  margin: 0 0 10px 0;
  padding: 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  font: 12px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.log-list li {
  padding: 3px 8px;
  border-radius: 4px;
  margin: 2px 0;
  word-break: break-all;
}
.log-info { background: #eef2ff; color: #2c4172; }
.log-ok   { background: #e8f5e9; color: #1b5e20; }
.log-warn { background: #fff8e1; color: #6d4c00; }
.log-err  { background: #ffebee; color: #b71c1c; }
.log-time {
  color: #86868b;
  margin-right: 6px;
}

/* 下载面板 */
.download-wrap { position: relative; display: inline-block; vertical-align: middle; }
.download-toggle { cursor: pointer; }
.download-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  padding: 8px 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}
.download-panel.hidden { display: none; }
.dl-option-btn {
  background: #f1f4f9;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  color: #1e293b;
  transition: 0.1s;
}
.dl-option-btn:hover { background: #e2e8f0; border-color: #94a3b8; }
