.simulation-history-launcher {
  position: fixed; z-index: 16; right: max(12px, env(safe-area-inset-right));
  bottom: max(64px, calc(52px + env(safe-area-inset-bottom)));
  width: 44px; height: 44px; display: grid; place-items: center;
  padding: 0; border: 1px solid var(--accent); border-radius: 50%;
  color: var(--accent-deep); background: var(--surface); cursor: pointer;
}
.simulation-history-launcher[hidden], .simulation-history-dialog [hidden] { display: none !important; }
.simulation-history-launcher:hover { color: var(--surface); background: var(--accent-deep); }
.simulation-history-launcher:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.simulation-history-dialog {
  width: min(1040px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px); box-sizing: border-box; overflow-y: auto;
  padding: clamp(18px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); background: var(--surface); font: inherit;
}
.simulation-history-dialog::backdrop { background: rgba(16,32,51,.6); }
.simulation-history-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.simulation-history-heading h2 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.3; }
.simulation-history-heading button { flex-shrink: 0; min-height: 44px; cursor: pointer; }
.simulation-history-description { color: var(--muted); }
.simulation-history-table { max-width: 100%; overflow-x: auto; margin-block: 24px; scrollbar-color: var(--accent) var(--paper); }
.simulation-history-table table { width: 100%; min-width: 760px; margin: 0; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.simulation-history-table th, .simulation-history-table td { padding: 12px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.simulation-history-table th:first-child, .simulation-history-table td:first-child,
.simulation-history-table th:last-child, .simulation-history-table td:last-child { text-align: left; }
.simulation-history-caption { text-align: left; font-weight: 700; padding-bottom: 12px; }
.simulation-history-table .simulation-pass { color: #1f5d42; font-weight: 700; }
.simulation-history-table .simulation-fail { color: #7b2d2d; font-weight: 700; }
.simulation-history-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.simulation-history-footer p { margin: 0; font-size: .8rem; color: var(--muted); }
.simulation-history-footer .question-history-reset { font-size: .88rem; color: var(--ink); }
@media print { .simulation-history-launcher, .simulation-history-dialog { display: none !important; } }
