:root {
  font:
    14px/1.45 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
a {
  color: var(--lavender);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.brand {
  font-size: 20px;
  font-weight: 750;
}
h1 {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
}
nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}
#engine-status {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.6px;
}
main {
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 215px;
  max-width: 2200px;
  margin: auto;
}
.configuration,
.inspector {
  padding: 20px;
  background: var(--panel);
}
.configuration {
  border-right: 1px solid var(--line);
}
.inspector {
  border-left: 1px solid var(--line);
}
h2 {
  font-size: 17px;
  margin: 0 0 20px;
}
h3 {
  font-size: 14px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
input,
select,
button {
  font: inherit;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 9px;
  min-width: 0;
}
input,
select {
  width: 100%;
}
button {
  cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) {
  border-color: var(--lavender);
  background: #352743;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
.primary {
  background: var(--lavender);
  border-color: var(--lavender);
  color: var(--bg);
  font-weight: 650;
}
.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--bg);
}
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--lavender);
}
input[type="range"] {
  padding: 0;
  accent-color: var(--lavender);
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
#apply {
  width: 100%;
  margin-top: 12px;
}
.workspace {
  min-width: 0;
}
.toolbar {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.view-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 12px 16px;
}
.view-controls label {
  margin: 0;
  min-width: 72px;
  flex: 1;
}
.view-controls button {
  height: 34px;
}
.viewport {
  position: relative;
  height: clamp(400px, 57vh, 780px);
  background: var(--bg);
}
#world {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.scene-caption {
  position: absolute;
  top: 18px;
  left: 22px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.scene-caption strong {
  font-size: 21px;
  font-weight: 500;
}
.scene-caption span,
.scene-hint {
  font-size: 12px;
  color: var(--muted);
}
.scene-hint {
  position: absolute;
  bottom: 16px;
  left: 22px;
  pointer-events: none;
}
#legend {
  position: absolute;
  right: 20px;
  top: 20px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}
#legend i {
  display: block;
  width: 65px;
  height: 5px;
  background: linear-gradient(90deg, #3d1f99, #edcc99);
}
.display-options {
  border-block: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 12px;
}
summary {
  cursor: pointer;
  color: var(--lavender);
  padding: 3px 0;
}
.display-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 14px;
  margin-top: 12px;
}
.display-grid label {
  margin: 0;
}
#slice-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  max-height: 200px;
  overflow: auto;
}
#slice-controls label {
  margin: 0;
}
.metrics {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--muted);
}
.metrics strong {
  font-size: 14px;
  color: var(--text);
  margin-left: 4px;
}
#timings {
  font-size: 11px;
  margin-left: auto;
}
.history {
  padding: 0 16px;
}
#convergence {
  display: block;
  width: 100%;
  height: 100px;
}
.timeline {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  font-size: 12px;
}
.timeline input {
  flex: 1;
  min-width: 60px;
}
.timeline label {
  margin: 0;
  min-width: 72px;
}
.timeline button {
  padding: 5px 8px;
}
.timeline output {
  white-space: nowrap;
}
#status {
  margin: 0;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 12px;
  min-height: 40px;
  border-top: 1px solid var(--line);
}
#status.error {
  color: #ffadc5;
}
.inspector label {
  margin-top: 16px;
}
#walker-info {
  font-size: 12px;
  overflow-wrap: anywhere;
}
#walker-info dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  text-align: right;
}
.coordinates {
  max-height: 240px;
  overflow: auto;
}
.coordinate {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}
#molecule-canvas {
  width: 100%;
  height: 200px;
  touch-action: none;
}
details.advanced {
  margin: 14px 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
details.advanced > div {
  padding-top: 12px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1200px) {
  main {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .inspector {
    grid-column: 2;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .configuration {
    grid-row: span 2;
  }
  #walker-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  #molecule-canvas {
    max-width: 320px;
  }
}
@media (max-width: 760px) {
  header {
    padding: 12px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 17px;
  }
  nav {
    gap: 12px;
    font-size: 12px;
  }
  #engine-status {
    width: 100%;
  }
  main {
    display: flex;
    flex-direction: column;
  }
  .configuration {
    order: 2;
    border-top: 1px solid var(--line);
  }
  .workspace {
    order: 1;
  }
  .inspector {
    order: 3;
  }
  .view-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
  .view-controls label {
    min-width: 75px;
  }
  .viewport {
    height: 430px;
  }
  .display-grid,
  #slice-controls {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline {
    flex-wrap: wrap;
  }
  .timeline input {
    flex-basis: 50%;
  }
  .toolbar {
    gap: 5px;
  }
  .toolbar button {
    font-size: 12px;
  }
  .scene-hint {
    font-size: 10px;
  }
  .metrics {
    gap: 10px;
  }
  .inspector {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
/* Keep convergence controls compact beside the full-width chart. */
.chart-axis {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: fit-content;
  font-size: 0.7rem;
  margin: 0.25rem 0 0.4rem;
}
.chart-axis select {
  width: 8rem;
}
