/* 新しい教材（docs/ROADMAP.md）で共通に使うレイアウトと部品 */

.sim {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 16px;
  padding: 16px 24px 32px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) {
  .sim { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 24px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.stage { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-tools {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
}
.stage-tools button {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 1.05rem;
}
.stage-tools button:hover { background: var(--bg); }
.stage-note { font-size: 0.82rem; color: var(--ink-soft); }

.side { display: flex; flex-direction: column; gap: 14px; }
.side .panel { gap: 10px; }
.label { font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; }

/* 式の大きな表示 */
.formula {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 700;
  text-align: center;
  padding: 8px 4px;
  font-family: "Times New Roman", "Hiragino Mincho ProN", serif;
  letter-spacing: 0.02em;
  min-height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15em;
  flex-wrap: wrap;
}
.formula i { font-style: italic; }
.formula sup { align-self: flex-start; font-size: 0.6em; margin: 0.15em 0 0 -0.12em; }
.formula .hidden-box {
  display: inline-block;
  min-width: 1.6em;
  height: 1.2em;
  border: 2px dashed #b9c4cf;
  border-radius: 8px;
  vertical-align: middle;
}
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.75em;
  line-height: 1.1;
  margin: 0 0.1em;
}
.frac > span:first-child { border-bottom: 0.08em solid currentColor; padding: 0 0.15em; }

/* スライダー */
.slider { display: grid; grid-template-columns: auto minmax(0, 1fr) 4.2em; align-items: center; gap: 10px; }
.slider .name { font-weight: 700; font-family: "Times New Roman", serif; font-style: italic; font-size: 1.3rem; min-width: 1.2em; }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.slider .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.slider.locked { opacity: 0.55; }

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  font-size: 0.95rem;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #1868b5; }
.btn[aria-pressed="true"] { background: #fdeee6; border-color: var(--warm); color: #b4471a; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 切りかえ（セグメント） */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 8px 14px; cursor: pointer; font-size: 0.95rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--ink); color: #fff; font-weight: 700; }
.seg button:disabled:not(.active) { opacity: 0.4; cursor: default; }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* 対応表 */
.table-wrap { overflow-x: auto; }
table.values { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.values th, table.values td {
  border: 1px solid var(--line);
  padding: 6px 4px;
  text-align: center;
  min-width: 2.4em;
  font-size: 0.98rem;
}
table.values th { background: var(--bg); font-family: "Times New Roman", serif; font-style: italic; font-size: 1.1rem; }
table.values td.hidden { color: transparent; background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 6px, #fff 6px, #fff 12px); }
table.values td.reveal { cursor: pointer; }
table.values td.now { background: var(--accent-soft); font-weight: 700; }

.readout {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 1rem;
}
.readout b { font-size: 1.2rem; color: var(--accent); }
.note { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--ink-soft); }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 4px; }
