* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: #16213e;
  border-radius: 8px;
  border: 1px solid #0f3460;
}

header h1 {
  color: #e94560;
  margin-bottom: 8px;
  font-size: 1.8rem;
}

header p {
  color: #a0a0a0;
  font-size: 0.95rem;
}

section {
  background: #16213e;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid #0f3460;
}

section h2 {
  color: #e94560;
  margin-bottom: 16px;
  font-size: 1.3rem;
  border-bottom: 1px solid #0f3460;
  padding-bottom: 8px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 0.85rem;
  color: #a0a0a0;
  margin-bottom: 4px;
  font-weight: 500;
}

.input-group input,
.input-group select {
  padding: 8px 12px;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.95rem;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: #e94560;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.9rem;
  color: #a0a0a0;
  font-weight: 500;
}

.preset-btn {
  padding: 6px 14px;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.preset-btn:hover {
  background: #0f3460;
  border-color: #e94560;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

button {
  padding: 10px 24px;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:active {
  transform: scale(0.98);
}

#runSimBtn {
  background: #e94560;
  color: #fff;
}

#runSimBtn:hover {
  background: #d63651;
}

.sweep-btn {
  background: #0f3460;
  color: #e0e0e0;
}

.sweep-btn:hover {
  background: #1a4a7a;
}

#calcKcBtn {
  background: #0f3460;
  color: #e0e0e0;
}

#calcKcBtn:hover {
  background: #1a4a7a;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #a0a0a0;
  font-style: italic;
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 200px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 16px;
}

.stat-card h3 {
  color: #e94560;
  font-size: 1rem;
  margin-bottom: 8px;
}

.stat-line {
  font-size: 0.9rem;
  color: #c0c0c0;
  margin-bottom: 4px;
}

.stat-line.highlight {
  color: #4ecca3;
  font-weight: 600;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #0f3460;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-container {
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 16px;
}

.chart-container.wide {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .charts-row {
    grid-template-columns: 1fr;
  }

  .input-grid {
    grid-template-columns: 1fr 1fr;
  }

  .button-row {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .input-grid {
    grid-template-columns: 1fr;
  }
}
