:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --line: #d8dee8;
  --accent: #2f6fed;
  --accent-dark: #1f55c7;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Arial, "Microsoft YaHei", sans-serif; }
button, select { font: inherit; }
.app { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 20px; }
.preview-panel { min-width: 0; display: grid; place-items: center; padding: 20px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
#previewCanvas { width: min(100%, calc(100vh - 80px)); max-width: 920px; aspect-ratio: 1 / 1; height: auto; display: block; border: 1px solid #e5e7eb; background: linear-gradient(45deg, #eeeeee 25%, transparent 25%), linear-gradient(-45deg, #eeeeee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eeeeee 75%), linear-gradient(-45deg, transparent 75%, #eeeeee 75%); background-position: 0 0, 0 12px, 12px -12px, -12px 0; background-size: 24px 24px; }
.control-panel { display: flex; flex-direction: column; min-height: 0; padding: 18px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.panel-header { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-header h1 { margin: 0 0 6px; font-size: 22px; line-height: 1.2; }
.panel-header p { margin: 0; min-height: 20px; color: var(--muted); font-size: 13px; }
.panel-header p.is-error { color: var(--danger); }
.controls { overflow: auto; display: grid; gap: 12px; padding: 16px 0; }
.fixed-notice { padding: 10px 12px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a; font-size: 13px; line-height: 1.45; }
.control-section { border: 1px solid var(--line); background: var(--panel-soft); }
.control-section summary { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; min-height: 48px; padding: 10px 12px; cursor: pointer; list-style: none; }
.control-section summary::-webkit-details-marker { display: none; }
.control-section summary::after { content: "展开"; color: var(--accent); font-size: 12px; font-weight: 700; }
.control-section[open] summary::after { content: "收起"; }
.section-title { font-weight: 800; font-size: 15px; }
.section-hint { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.section-body { display: grid; gap: 10px; padding: 0 10px 12px; }
.control-group { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); background: var(--panel-soft); }
.control-section .control-group { background: #ffffff; }
.control-group label { font-weight: 700; font-size: 14px; }
.control-group select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid #bfc7d4; background: #ffffff; color: var(--text); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.actions button { min-height: 42px; border: 1px solid var(--accent); background: #ffffff; color: var(--accent); cursor: pointer; }
.actions button:hover { border-color: var(--accent-dark); color: var(--accent-dark); }
.actions button:last-child { background: var(--accent); color: #ffffff; }
.actions button:last-child:hover { background: var(--accent-dark); color: #ffffff; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .control-panel { min-height: auto; }
  #previewCanvas { width: min(100%, calc(100vh - 260px)); min-width: 260px; }
}
