@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #0e111a;
  --panel: #141a25;
  --panel-2: #0f141e;
  --ink: #e7ecf3;
  --muted: #9aa7bf;
  --accent: #6ad7e5;
  --accent-2: #e9b86a;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 10%, rgba(106, 215, 229, 0.12), transparent 40%),
              radial-gradient(circle at 80% 0%, rgba(233, 184, 106, 0.12), transparent 35%),
              var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--muted);
}

h1 {
  margin: 8px 0 6px;
  font-size: 34px;
  font-weight: 600;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.status {
  padding: 10px 16px;
  background: rgba(106, 215, 229, 0.15);
  border: 1px solid rgba(106, 215, 229, 0.35);
  border-radius: 999px;
  font-size: 14px;
}

.panel {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.controls {
  display: grid;
  gap: 18px;
}

.group label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  display: block;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row.small {
  font-size: 13px;
  color: var(--muted);
  gap: 12px;
}

input {
  background: var(--panel-2);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  width: 92px;
}

select {
  background: var(--panel-2);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

button {
  background: linear-gradient(135deg, var(--accent), #4bb4d2);
  color: #051018;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(106, 215, 229, 0.25);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.metric {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 12px;
}

.metric .label {
  font-size: 12px;
  color: var(--muted);
}

.metric .value {
  font-size: 16px;
  font-weight: 600;
  margin-top: 6px;
}

.plot-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.plot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.plot-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plot h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.legend {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.frame-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.frame-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.frame-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  min-width: 120px;
  text-align: right;
}

canvas {
  width: 100%;
  height: auto;
  min-height: 240px;
  aspect-ratio: 4 / 3;
  display: block;
  background: #05070c;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.plot canvas#energyPlot,
.plot canvas#errorPlot {
  aspect-ratio: 16 / 9;
  min-height: 200px;
  background: #ffffff;
}

.log-panel pre {
  background: #05070c;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  color: #c5d0e6;
}

.chip {
  background: rgba(233, 184, 106, 0.2);
  color: var(--accent-2);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(233, 184, 106, 0.4);
}

.footer {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .header {
    flex-direction: column;
  }

  input {
    width: 100%;
  }

  button {
    width: 100%;
  }

  .frame-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .frame-label {
    text-align: left;
  }
}
