:root {
  --bg: #f6f4f1;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --accent: #2f5d50;
  --accent-light: #e8f2ee;
  --border: #e5e1db;
  --warn: #9a6b1a;
  --bad: #a33b3b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.header, .footer {
  padding: 1.25rem 1.5rem;
  background: var(--accent);
  color: #fff;
}
.header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.subtitle { margin: 0; opacity: 0.85; }
.footer { font-size: 0.85rem; background: #24463c; }
.footer a { color: #cfe6dc; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card h2 { margin-top: 0; font-size: 1.1rem; }
.card h3 { margin: 0.75rem 0 0.5rem; font-size: 0.95rem; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.product-item {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #fff;
}
.product-item.selected { border-color: var(--accent); background: var(--accent-light); }
.product-item .thumb {
  width: 100%;
  height: 88px;
  border-radius: 6px;
  background: linear-gradient(135deg, #dfe8e3, #c5d4cc);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}
.product-item h3 { margin: 0.5rem 0 0.25rem; font-size: 0.95rem; }
.product-item p { margin: 0; color: var(--muted); font-size: 0.8rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
input, select, button {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  margin-top: 0.5rem;
}
button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  margin-left: 0.5rem;
}

/* 浅/白底 button：局部只改 background 时，避免继承上文全局白字 */
button:is(
  .secondary,
  .mc-btn-menu,
  .mcw-tile,
  .mcw-adv-tab,
  .mcp-tree-head,
  .mcp-tree-subhead,
  .mcp-nav-item,
  .dg-tab,
  .board-tab,
  .board-view
) {
  color: var(--text);
}

button.dg-tab.active {
  color: #2f6b4f;
}

button.mcp-nav-item.active {
  color: var(--accent);
}
button:disabled { opacity: 0.6; cursor: not-allowed; }
.privacy { color: var(--muted); font-size: 0.8rem; }
.flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.actions button { margin-top: 0; margin-left: 0; }
input[type="file"] {
  padding: 0.4rem;
  background: #faf8f5;
}

.status { padding: 0.75rem; background: #faf8f5; border-radius: 8px; }
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.size-result {
  background: var(--accent-light);
  padding: 1rem;
  border-radius: 8px;
  line-height: 1.6;
}
.check-result {
  background: #faf8f5;
  padding: 1rem;
  border-radius: 8px;
  line-height: 1.6;
  border: 1px solid var(--border);
}
.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-light);
  color: var(--accent);
}
.tag.warn { background: #f7edd8; color: var(--warn); }
.tag.bad { background: #f5e0e0; color: var(--bad); }
.hidden { display: none; }
.err { color: var(--bad); font-size: 0.9rem; margin-top: 0.5rem; }
pre.raw {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #faf8f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  font-size: 0.75rem;
  max-height: 220px;
}

.mesh-viewer {
  position: relative;
  width: 100%;
  height: min(56vh, 520px);
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #f4efe8 0%, #e5ddd2 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  user-select: none;
  -webkit-user-select: none;
}
.mesh-canvas-host {
  width: 100%;
  height: 100%;
}
.mesh-canvas-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.mesh-drag-hint {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(47, 93, 80, 0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.4s;
  z-index: 2;
}
.mesh-viewer-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--bad);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  text-align: center;
  z-index: 3;
}
.mesh-viewer-note {
  position: absolute;
  left: 0.75rem;
  bottom: 0.55rem;
  margin: 0;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 1px 0 #fff;
}

@media (max-width: 720px) {
  .form-row, .result-grid { grid-template-columns: 1fr; }
  button.secondary { margin-left: 0; }
  .mesh-viewer { height: 48vh; min-height: 300px; }
}

/* demo-3d 场景左侧：当前模型参数面板（窄栏，不挡模型） */
.model-params-panel {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2;
  width: min(220px, 32%);
  max-width: 220px;
  max-height: calc(100% - 1.2rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  background: rgba(18, 22, 26, 0.82);
  border-left: 3px solid #ffd60a;
  pointer-events: none;
  font-size: 10px;
  line-height: 1.35;
  box-sizing: border-box;
}
.model-params-panel .mp-title {
  color: #ffd60a;
  font-weight: 700;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-params-panel .mp-sec {
  color: #7dd3fc;
  font-weight: 600;
  margin-top: 4px;
}
.model-params-panel .mp-row {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}
.model-params-panel .mp-label {
  color: #b8c0c8;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-params-panel .mp-value {
  color: #ffd60a;
  font-weight: 600;
  text-align: right;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
