* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #04070f; }
body { font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif; color: #cfe0f5; }
canvas { display: block; cursor: grab; }
canvas:active { cursor: grabbing; }

#topbar {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(8, 16, 32, 0.62); border: 1px solid rgba(120, 180, 255, 0.25);
  padding: 8px 26px; border-radius: 22px; text-align: center; z-index: 10;
  backdrop-filter: blur(8px); pointer-events: none; white-space: nowrap;
}
#topbar h1 { font-size: 17px; letter-spacing: 3px; color: #eaf6ff; text-shadow: 0 0 12px rgba(120, 190, 255, 0.7); }
#topbar p { font-size: 11px; color: rgba(200, 220, 245, 0.75); margin-top: 3px; letter-spacing: 1px; }

#panel {
  position: fixed; top: 50%; right: 14px; transform: translateY(-50%);
  background: rgba(8, 16, 32, 0.72); border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 14px; padding: 14px 16px; z-index: 10; backdrop-filter: blur(10px);
  width: 258px; max-height: calc(100vh - 40px); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(120,180,255,.4) transparent;
}
#panel h2 { font-size: 12px; letter-spacing: 2px; margin: 12px 0 6px; color: #9fd0ff; border-bottom: 1px solid rgba(120,180,255,0.15); padding-bottom: 3px; }
#panel h2:first-child { margin-top: 0; }
.modes { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: #cfe0f5; }
.modes label { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.modes input { accent-color: #6ab0ff; }
.row { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 12px; }
.row label { flex: 0 0 56px; color: #a9c2dd; }
.row input[type=range] { flex: 1; accent-color: #6ab0ff; cursor: pointer; }
.row span { min-width: 62px; text-align: right; font-weight: 600; color: #eaf6ff; font-size: 12px; }
.toggles { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: #cfe0f5; }
.toggles label { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.toggles input { accent-color: #6ab0ff; }
.btns { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.btns button {
  padding: 7px 0; border-radius: 9px; cursor: pointer; font-size: 13px; letter-spacing: 1px;
  background: rgba(90, 150, 255, 0.16); border: 1px solid rgba(140, 190, 255, 0.45); color: #dceeff;
  transition: all .18s;
}
.btns button:hover { background: rgba(90, 150, 255, 0.38); }

#info {
  position: fixed; top: 76px; left: 16px; z-index: 10;
  background: rgba(8, 16, 32, 0.72); border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 12px; padding: 10px 14px; backdrop-filter: blur(8px);
  font-size: 12px; line-height: 1.7; min-width: 190px;
}
#info div { display: flex; justify-content: space-between; gap: 14px; }
#info span { color: #8fa9c8; }
#info b { color: #eaf6ff; font-weight: 600; }

#legend {
  position: fixed; bottom: 16px; left: 16px; z-index: 10;
  background: rgba(8, 16, 32, 0.72); border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 12px; padding: 10px 14px; backdrop-filter: blur(8px);
  font-size: 11px; max-width: 240px; color: #cfe0f5;
  display: flex; flex-wrap: wrap; gap: 4px 10px;
}
#legend .sw { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
#legend .sw i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ramp-title { width: 100%; color: #9fd0ff; margin-bottom: 2px; }
.ramp { width: 190px; height: 10px; border-radius: 5px; }
.ramp-labels { width: 190px; display: flex; justify-content: space-between; color: #8fa9c8; }

#errlog {
  position: fixed; bottom: 16px; right: 16px; z-index: 30;
  background: rgba(120, 20, 20, 0.85); color: #ffd7d7; border-radius: 8px;
  padding: 8px 12px; font-size: 12px; max-width: 420px;
}

#hint {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(8, 16, 32, 0.55); border: 1px solid rgba(120, 180, 255, 0.18);
  border-radius: 14px; padding: 6px 18px; font-size: 11px; color: rgba(200, 220, 245, 0.7);
  backdrop-filter: blur(6px); pointer-events: none; z-index: 9; white-space: nowrap;
}
