:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --primary-color: #38bdf8;
  --accent-color: #f472b6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: rgba(148, 163, 184, 0.2);
  --font-family: 'Outfit', sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.simulation-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.canvas-wrapper {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at bottom left, #1e293b 0%, #0f172a 100%);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay-info {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  border: 1px solid var(--border-color);
}

.controls {
  width: 350px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--border-color);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-color);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.value-display {
  font-family: monospace;
  min-width: 60px;
  text-align: right;
  color: var(--text-main);
}

.note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.equations-panel {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.equations-panel.visible {
  opacity: 1;
  pointer-events: auto;
}

.equations-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--accent-color);
}

.equation {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  min-height: 2em;
  /* Prevent jump when rendering latex */
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

button {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-family);
}

button.primary {
  background: var(--primary-color);
  color: #0f172a;
}

button.primary:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  .simulation-container {
    flex-direction: column;
  }

  .controls {
    width: 100%;
    height: 40%;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
}