* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: #f4f6fb;
  color: #1c2233;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: linear-gradient(90deg,#0a66c2,#1e88e5);
  color: white; box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { font-size: 28px; }
.title { font-size: 18px; font-weight: 600; }
.subtitle { font-size: 12px; opacity: .8; }
.topbar-right select {
  padding: 6px 10px; border-radius: 6px; border: 0; background: #ffffff20;
  color: white; font-size: 13px; cursor: pointer;
}
.topbar-right select option { color: #1c2233; }

.app {
  display: grid; grid-template-columns: 320px 1fr 500px; gap: 14px;
  padding: 14px; height: calc(100vh - 56px);
}
.col {
  background: white; border-radius: 10px; padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow-y: auto;
}
.col h2 { font-size: 14px; margin: 0 0 10px; color: #0a66c2; }

textarea {
  width: 100%; font-size: 13px; padding: 10px; border-radius: 8px;
  border: 1px solid #d0d7e2; resize: vertical; font-family: inherit;
}
.mode-toggle { display: flex; gap: 16px; margin: 10px 0; font-size: 13px; }
.examples-title { font-size: 12px; color: #6b778c; margin: 14px 0 6px; }
.examples { margin-bottom: 14px; }
#examples-list button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: #f2f6fc; border: 1px solid #dde5f0; color: #24344d;
  border-radius: 6px; margin-bottom: 6px; cursor: pointer; font-size: 12px;
  line-height: 1.4;
}
#examples-list button:hover { background: #e3ecfa; }

.run-btn {
  width: 100%; padding: 12px; font-size: 14px; font-weight: 600;
  background: linear-gradient(90deg,#0a66c2,#1e88e5); color: white;
  border: 0; border-radius: 8px; cursor: pointer;
}
.run-btn:disabled { opacity: .55; cursor: wait; }
.status { margin-top: 10px; font-size: 12px; color: #6b778c; min-height: 18px; }

/* pipeline */
.pipeline {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px;
}
.skill-card {
  background: #f8fafd; border: 1px solid #e3e8f2; border-left: 3px solid #cbd4e1;
  padding: 8px 10px; border-radius: 6px; font-size: 12px;
  transition: all .25s;
}
.skill-card.running {
  border-left-color: #0a66c2; background: #eaf3ff;
  animation: pulse 1s ease-in-out infinite alternate;
}
.skill-card.done { border-left-color: #22c55e; background: #f0fdf4; }
.skill-card.error { border-left-color: #ef4444; background: #fef2f2; }
.skill-card .hdr { display: flex; justify-content: space-between; font-weight: 600; }
.skill-card .desc { color: #6b778c; margin-top: 3px; font-size: 11px; }
.skill-card .summary { margin-top: 4px; color: #24344d; font-size: 11px; line-height: 1.4; }
@keyframes pulse { from { box-shadow: 0 0 0 rgba(10,102,194,0); } to { box-shadow: 0 0 8px rgba(10,102,194,.3); } }

.code-panel, .log-panel, .review-panel {
  background: #fafbfd; border: 1px solid #e3e8f2; border-radius: 6px; padding: 8px 10px;
  margin-bottom: 8px; font-size: 12px;
}
.code-panel pre { max-height: 320px; overflow: auto; margin: 8px 0 0; background: #0e1526; color: #d5e6ff; padding: 10px; border-radius: 6px; font-size: 12px; }
.code-panel code { font-family: "SFMono-Regular", Consolas, monospace; }
.review-body { padding: 6px 0; font-size: 12px; line-height: 1.6; }
.review-body h4 { margin: 8px 0 4px; color: #0a66c2; font-size: 12px; }
.review-body ul { margin: 0; padding-left: 18px; }
.review-body .score { font-size: 20px; font-weight: 700; color: #0a66c2; }
#log-body { max-height: 160px; overflow: auto; padding: 6px 0; font-family: monospace; font-size: 11px; color: #465570; }
#log-body .lv-error { color: #b91c1c; }
#log-body .lv-warn { color: #b45309; }

/* preview */
.preview-2d, .preview-3d {
  background: #fbfcfe; border: 1px solid #e3e8f2; border-radius: 8px;
  min-height: 380px; padding: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; margin-bottom: 12px;
}
.preview-2d svg { max-width: 100%; max-height: 500px; }
.placeholder { color: #a3adc2; font-size: 13px; }

.preview-3d { padding: 0; position: relative; }
#three-container { width: 100%; height: 440px; border-radius: 8px; overflow: hidden; }
.view-controls {
  display: flex; gap: 6px; padding: 8px; flex-wrap: wrap;
  border-top: 1px solid #e3e8f2; width: 100%; justify-content: center;
}
.view-controls button {
  padding: 5px 10px; font-size: 12px; border-radius: 5px;
  background: #eaf3ff; border: 1px solid #b8d4f5; color: #0a66c2;
  cursor: pointer;
}
.view-controls button:hover { background: #d3e6fa; }
.hint { padding: 0 0 8px; font-size: 11px; color: #93a0b8; }

.downloads {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
}
.downloads a {
  padding: 8px 12px; background: #0a66c2; color: white; border-radius: 6px;
  text-decoration: none; font-size: 12px; font-weight: 500;
}
.downloads a.primary {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}
.downloads a:hover { opacity: .9; }

.chat-section {
  margin-top: 20px; padding-top: 14px; border-top: 1px dashed #d0d7e2;
}
.chat-section h3 { font-size: 13px; margin: 0 0 8px; color: #0a66c2; }
.chat-history { max-height: 180px; overflow-y: auto; margin-bottom: 8px; font-size: 12px; }
.chat-msg { background: #f2f6fc; border-left: 3px solid #0a66c2; padding: 6px 8px;
  margin-bottom: 6px; border-radius: 4px; line-height: 1.4; }
.chat-msg.user { border-left-color: #16a34a; background: #f0fdf4; }
.chat-actions { display: flex; gap: 6px; margin-top: 6px; }
.chat-actions .run-btn { flex: 1; padding: 8px; font-size: 13px; }
.secondary-btn {
  padding: 8px 12px; background: #f0f2f7; color: #495468; border: 1px solid #d0d7e2;
  border-radius: 6px; cursor: pointer; font-size: 12px;
}
