* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: #f4f6fb; color: #1a2238;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
  overflow: hidden;
  height: 100vh;
}
#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}
header {
  padding: 10px 18px;
  background: #ffffff;
  border-bottom: 1px solid #d8def0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
header h1 {
  margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.3px;
  color: #1a2238;
}
header .legend {
  display: flex; gap: 14px; font-size: 12px; color: #4b5878;
}
header .legend span.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle;
  box-shadow: 0 0 0 1px #ffffff, 0 0 0 2px rgba(0,0,0,0.08);
}
#main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #d8def0;
  overflow: hidden;
  min-height: 0;
}
.panel {
  position: relative;
  background: #ffffff;
  overflow: hidden;
}
.panel .label {
  position: absolute; top: 10px; left: 12px;
  font-size: 12px; font-weight: 600; color: #1a2238;
  background: rgba(255,255,255,0.92);
  padding: 3px 9px; border-radius: 4px;
  border: 1px solid #e1e6f3;
  pointer-events: none;
  z-index: 5;
}
.panel .hint {
  position: absolute; bottom: 10px; left: 12px;
  font-size: 11px; color: #4b5878;
  background: rgba(255,255,255,0.85);
  padding: 3px 9px; border-radius: 4px;
  border: 1px solid #e1e6f3;
  pointer-events: none;
  z-index: 5;
}
#canvas2d {
  width: 100%; height: 100%;
  display: block; cursor: crosshair;
}
#canvas3d {
  width: 100%; height: 100%;
}
footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #d8def0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.section {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: #f4f6fb;
  border: 1px solid #d8def0;
  border-radius: 7px;
  position: relative;
}
.section .section-title {
  position: absolute;
  top: -8px; left: 8px;
  font-size: 10px; font-weight: 700;
  color: #4b5878;
  background: #ffffff;
  padding: 0 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.section.sec-field { border-color: #ffb1be; background: #fff5f7; }
.section.sec-field .section-title { color: #b1394c; }
.section.sec-particle { border-color: #b8d7ff; background: #f3f8ff; }
.section.sec-particle .section-title { color: #2a55a8; }
.section.sec-sim { border-color: #b3e0c4; background: #f3faf5; }
.section.sec-sim .section-title { color: #2a7a4a; }
.section.sec-view { border-color: #d8def0; }
.section.sec-view .section-title { color: #4b5878; }

.label-s {
  font-size: 11px; color: #4b5878; margin-right: 2px;
}
button {
  background: #ffffff;
  color: #1a2238;
  border: 1px solid #c5cce0;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
button:hover { background: #eef2fa; border-color: #95a3c8; }
button.active { background: #1a2238; color: #ffffff; border-color: #1a2238; }
.sec-field button.active { background: #d44056; border-color: #b1394c; color: #fff; }
.sec-particle button.active { background: #3873d4; border-color: #2a55a8; color: #fff; }
button.danger { background: #ffeef0; border-color: #f0b1bc; color: #a32f43; }
button.danger:hover { background: #ffd9dd; }
button.go { background: #e7f6ec; border-color: #8dcaa3; color: #1f7a40; }
button.go:hover { background: #d2eddc; }
button.go.running { background: #fff3d8; border-color: #f0c878; color: #8a5e10; }
input[type=range] { width: 96px; accent-color: #3873d4; }
.slider-val { font-size: 11px; color: #1a2238; min-width: 30px; display: inline-block; text-align: right; font-variant-numeric: tabular-nums; }
label.chk { font-size: 12px; color: #1a2238; display: flex; align-items: center; gap: 4px; cursor: pointer; }
label.chk input { accent-color: #3873d4; }
