* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  height: 100%;
  overflow: hidden;
  background: #f0f0f0;
  color: #222;
  font-family: 'Segoe UI', 'Meiryo', sans-serif;
}
body { display: flex; flex-direction: column; }

#header {
  flex: none;
  background: rgba(236, 236, 242, 0.97);
  border-bottom: 1px solid #bbc;
  padding: 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 10;
}
#header .row {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  flex-wrap: wrap;
  min-height: 28px;
}
h1 { font-size: 13px; color: #2255cc; white-space: nowrap; margin-right: 4px; }
h1 small { font-weight: normal; color: #557; }

.education-back {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-height: 24px; padding: 2px 10px; border: 1px solid #b8c4d4; border-radius: 6px;
  background: #fff; color: #36556f; font-size: 12px; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
}
.education-back:hover, .education-back:focus-visible {
  border-color: #2b6cb0; background: #eef4fb; color: #2b6cb0;
}

.ctrl { display: flex; align-items: center; gap: 5px; font-size: 11px; white-space: nowrap; }
.ctrl label { color: #444; }
.ctrl input[type=range] { width: 92px; cursor: pointer; accent-color: #3366cc; }
.ctrl .v { font-family: Consolas, monospace; color: #116611; min-width: 58px; font-size: 11px; }
.ctrl select {
  font-size: 11px; padding: 1px 3px; border: 1px solid #aab; border-radius: 3px; background: #fff; cursor: pointer;
}
.ctrl select option:disabled { color: #c4c4cc; } /* 選べない選択肢は薄く */
.ctrl select:disabled { color: #99a; background: #f4f4f6; cursor: default; }
.btns { gap: 4px; }
button {
  background: #e4e8f4; color: #2255cc; border: 1px solid #aab;
  padding: 3px 9px; cursor: pointer; border-radius: 3px; font-size: 11px; white-space: nowrap;
}
button:hover { background: #d6ddf0; }
button:disabled { color: #99a; cursor: default; }
.chk { display: flex; align-items: center; gap: 3px; font-size: 11px; color: #444; white-space: nowrap; cursor: pointer; }
.chk input { cursor: pointer; accent-color: #3366cc; }
.chk.disabled { color: #aab; cursor: default; }
.chk.disabled input { cursor: default; }

#main { flex: 1; display: flex; min-height: 0; }
#viewport { flex: 1; position: relative; min-width: 0; }
#c3d { display: block; width: 100%; height: 100%; }
#overlay {
  position: absolute; left: 10px; top: 8px; pointer-events: none;
  font-size: 11px; font-family: Consolas, monospace; color: #445;
}
#warn {
  margin-top: 4px; padding: 3px 8px; background: #fff3e0; border: 1px solid #ffb74d;
  color: #e65100; border-radius: 3px; font-family: 'Segoe UI', 'Meiryo', sans-serif; font-weight: bold;
}

#note {
  margin-top: 4px; padding: 3px 8px; max-width: 430px; background: rgba(255, 255, 255, 0.85); border: 1px solid #b8c4d4;
  color: #36556f; border-radius: 3px; font-family: 'Segoe UI', 'Meiryo', sans-serif; line-height: 1.5; white-space: normal;
}

#sidebar {
  width: 310px; flex-shrink: 0;
  background: rgba(236, 236, 242, 0.97);
  border-left: 1px solid #bbc;
  display: flex; flex-direction: column;
  padding: 8px; gap: 6px; overflow-y: auto;
}
.pt { font-size: 11px; color: #2255cc; border-bottom: 1px solid #ccd; padding-bottom: 3px; margin-top: 2px; }
.pt .sub { color: #778; font-size: 9px; }
.chart { width: 100%; height: 96px; border: 1px solid #ccd; border-radius: 3px; background: #fff; flex: none; }
.ig { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ii { background: rgba(0, 0, 0, 0.06); padding: 3px 6px; border-radius: 3px; }
.ii .lb { font-size: 9px; color: #555; margin-bottom: 1px; }
.ii .vl { font-size: 11px; font-family: Consolas, monospace; color: #116611; }
.ii.off { opacity: 0.4; }
.hint { font-size: 10px; color: #555; line-height: 1.7; }
.legend { font-size: 10px; color: #555; line-height: 2; }
.legend .lrow { display: flex; flex-wrap: wrap; gap: 0 14px; } /* 似た項目は横に並べる */
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.legend .ln { display: inline-block; width: 16px; height: 0; border-top: 1.5px solid #333; vertical-align: 3px; }

@media (max-width: 860px) {
  html, body { overflow: auto; height: auto; }
  body { display: block; }
  #main { flex-direction: column; }
  #viewport { height: 70vh; }
  #sidebar { width: 100%; border-left: none; border-top: 1px solid #bbc; }
}
.tool-links a { color: #2255cc; }
