* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f8;
  color: #111827;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 2rem;
}

nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.navlink {
  text-decoration: none;
  color: #111827;
  background: white;
  border: 1px solid #d1d5db;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.navlink.active {
  background: #111827;
  color: white;
  border-color: #111827;
}

.card {
  background: white;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  margin-bottom: 18px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.muted {
  color: #4b5563;
}

.math {
  font-family: "Times New Roman", serif;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control label {
  font-weight: 700;
}

.control input[type="number"],
.control input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
}

.control input[type="range"] {
  width: 100%;
}

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

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

button {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  background: #111827;
  color: white;
  font-weight: 700;
  font-size: 0.98rem;
}

button:hover {
  opacity: 0.93;
}

canvas {
  width: 100%;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: right;
}

th {
  background: #f9fafb;
}

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

.stat-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
}

.stat-label {
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 10px;
}

.checkbox-row input[type="checkbox"] {
  transform: scale(1.15);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 10px;
}

.checkbox-row input[type="checkbox"] {
  transform: scale(1.15);
}
