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

body {
  font-family: 'Noto Sans', sans-serif;
  background: #ffffff;
  color: #222;
  padding: 20px;
  overflow-x: hidden;
}

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

.formula-section {
  background: #f8f8f8;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
}

.explanation {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
}

.formula, .formula-alt {
  font-size: 18px;
  margin: 10px 0;
  font-weight: 500;
}

.fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  margin: 0 4px;
}

.numerator {
  border-bottom: 1px solid #222;
  padding: 2px 8px;
}

.denominator {
  padding: 2px 8px;
}

.interactive-section {
  background: white;
}

.controls {
  margin-bottom: 20px;
}

.control-group {
  margin-bottom: 15px;
}

.control-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 14px;
}

.control-group input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #222;
  cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #222;
  cursor: pointer;
  border: none;
}

.visualization {
  margin: 20px 0;
  background: #fafafa;
  padding: 15px;
  border-radius: 8px;
}

#acorn-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.acorn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.row-label {
  font-size: 13px;
  font-weight: 600;
  min-width: 50px;
  color: #555;
}

.acorns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.acorn {
  font-size: 20px;
  animation: pop 0.2s ease-out;
}

@keyframes pop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.count-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  min-width: 40px;
  text-align: right;
}

.result {
  background: #f8f8f8;
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
}

.calculation {
  margin-bottom: 10px;
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.sum {
  font-size: 22px;
  font-weight: 600;
  color: #222;
}

@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .formula, .formula-alt {
    font-size: 16px;
  }

  .sum {
    font-size: 20px;
  }

  .acorn {
    font-size: 18px;
  }
  
  .row-label {
    min-width: 45px;
    font-size: 12px;
  }
  
  .count-label {
    font-size: 12px;
  }
}