.function-explorer {
  margin: 1rem 0 1.6rem;
  padding: 1.1rem;
  border: 1px solid #b8d8dc;
  border-radius: .6rem;
  background: #f7fbfc;
  color: #243237;
}
.function-explorer .fx-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: .8rem;
}
.function-explorer label { font-weight: 600; font-size: .9rem; }
.function-explorer select, .function-explorer button {
  display: block;
  font: inherit;
  color: inherit;
  background: white;
  border: 1px solid #7a969c;
  border-radius: .3rem;
  padding: .3rem .5rem;
}
.function-explorer button { cursor: pointer; }
.function-explorer :focus-visible { outline: 3px solid #ec660c; outline-offset: 3px; }
.function-explorer .fx-formula {
  display: block;
  padding: .6rem .8rem;
  border-left: 4px solid #ec660c;
  background: white;
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.function-explorer .fx-formula.fx-math-formula {
  font-family: "Cambria Math", "DejaVu Serif", serif;
  font-size: 1.15rem;
}
.function-explorer .fx-logarithm,
.function-explorer .fx-power { white-space: nowrap; }
.function-explorer .fx-logarithm sub,
.function-explorer .fx-power sup { font-size: .75em; }
.function-explorer .fx-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: .8rem 1.2rem;
  margin: 1rem 0 .2rem;
}
.function-explorer .fx-control-head { display: flex; justify-content: space-between; gap: .6rem; }
.function-explorer input[type="range"] { width: 100%; accent-color: #237e89; min-height: 28px; }
.function-explorer svg { display: block; width: 100%; height: auto; background: white; border-radius: .3rem; }
.function-explorer .fx-note { font-size: .88rem; margin: .65rem 0 .2rem; }
.function-explorer .fx-values { font-size: .85rem; margin: .4rem 0 0; }
.function-explorer .fx-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; margin: .4rem 0; }
.function-explorer .fx-legend span::before {
  content: ""; display: inline-block; width: 1.5rem; height: 3px;
  background: #237e89; vertical-align: middle; margin-right: .3rem;
}
.function-explorer .fx-legend span + span::before { background: #ec660c; }
@media (max-width: 480px) {
  .function-explorer { padding: .65rem; }
  .function-explorer .fx-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media print { .function-explorer .fx-toolbar, .function-explorer .fx-controls { display: none; } }

.function-explorer .fx-controls label { min-width: 0; }
.function-explorer .fx-control-head span { overflow-wrap: anywhere; }

/* Each lecture slide keeps the graph beside its controls and live notes. */
.reveal .function-explorer {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(0, 1fr);
  grid-template-areas:
    "toolbar toolbar"
    "formula formula"
    "graph controls"
    "graph note"
    "legend note"
    "values note";
  gap: 6px 20px;
  margin: 0;
  padding: 10px;
  font-size: 20px;
  line-height: 1.25;
  text-align: left;
}
.reveal .function-explorer .fx-toolbar {
  grid-area: toolbar;
  gap: 12px;
  margin: 0;
}
.reveal .function-explorer label { font-size: 20px; }
.reveal .function-explorer .fx-toolbar label { font-size: 18px; }
.reveal .function-explorer select,
.reveal .function-explorer button { font-size: 20px; }
.reveal .function-explorer .fx-formula {
  grid-area: formula;
  padding: 8px 12px;
  font-size: 24px;
}
.reveal .function-explorer .fx-formula.fx-math-formula { font-size: 26px; }
.reveal .function-explorer .fx-controls {
  grid-area: controls;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  margin: 0;
}
.reveal .function-explorer input[type="range"] { min-height: 32px; }
.reveal .function-explorer svg {
  grid-area: graph;
  align-self: start;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
}
.reveal .function-explorer svg text { font-size: 18px; }
.reveal .function-explorer .fx-legend {
  grid-area: legend;
  gap: 16px;
  margin: 0;
  font-size: 18px;
}
.reveal .function-explorer .fx-note {
  grid-area: note;
  align-self: start;
  margin: 0;
  font-size: 20px;
}
.reveal .function-explorer .fx-values {
  grid-area: values;
  margin: 0;
  font-size: 18px;
}
