:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #596579;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --line: #dbe1eb;
  --accent: #275fbd;
  --accent-dark: #16498f;
  --error: #a52a2a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #e5edff 0, transparent 32rem),
    var(--paper);
}

a {
  color: var(--accent-dark);
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.landing {
  padding: 5rem 0 2rem;
}

.hero {
  max-width: 760px;
  margin-bottom: 3rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero > p:last-child {
  max-width: 680px;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 1rem;
}

.distribution-card {
  display: flex;
  min-height: 270px;
  flex-direction: column;
  padding: 1.5rem;
  color: inherit;
  text-decoration: none;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 35px rgb(34 52 84 / 7%);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.distribution-card:hover,
.distribution-card:focus-visible {
  border-color: #9fb9e7;
  box-shadow: 0 16px 42px rgb(34 52 84 / 13%);
  outline: none;
  transform: translateY(-3px);
}

.card-symbol {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
}

.distribution-card h2 {
  margin: 1.5rem 0 0.6rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
}

.distribution-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.open-label {
  margin-top: auto;
  padding-top: 1.4rem;
  color: var(--accent-dark);
  font-weight: 700;
}

footer {
  padding: 2.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.visualizer {
  padding: 1.4rem 0 2rem;
}

nav {
  margin-bottom: 1.8rem;
}

nav a {
  font-weight: 700;
  text-decoration: none;
}

.visualizer-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.visualizer-header h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.reset-button,
.error-panel button {
  padding: 0.7rem 1.1rem;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.reset-button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.runtime-status,
.error-panel {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 2rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.spinner {
  width: 1.3rem;
  height: 1.3rem;
  border: 3px solid #c7d3e8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-panel {
  display: block;
  color: var(--error);
}

.error-panel h2 {
  margin-top: 0;
}

.app-panel {
  display: grid;
  grid-template-columns: minmax(210px, 270px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.controls,
.plot-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgb(34 52 84 / 6%);
}

.controls {
  display: grid;
  gap: 1.4rem;
  padding: 1.2rem;
}

.control label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.control output {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.control input {
  width: 100%;
  accent-color: var(--accent);
}

.plot-frame {
  position: relative;
  min-height: 400px;
  padding: 0.5rem;
  overflow: hidden;
}

.plot-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.updating-indicator {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  padding: 0.4rem 0.65rem;
  color: #fff;
  background: rgb(23 32 51 / 78%);
  border-radius: 7px;
  font-size: 0.8rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .landing {
    padding-top: 3rem;
  }

  .app-panel {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }

  .visualizer-header {
    align-items: start;
  }
}
