html { 
  font-size: 80%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Noto Sans JP", "Yu Gothic", "YuGothic",
    Meiryo, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #ebf5ff;
  color: #000000;
  margin: 0;
  line-height: 1.7;
}

main, .container {
  max-width: 70ch;
  padding: 1.25rem;
  margin: 0 auto;
}

footer {
  border-top: 1px solid #ccc;

  max-width: 70ch;
  padding: 1.25rem;
  margin: 0 auto;
  line-height: 1.2;
}

h1 {
  background-color: #2563eb;
  color: white;
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
  margin: 1rem 0;
}

h2 {
  color: #000000;
  text-align: left;
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  padding: 0.4rem 0;
  margin: 1rem 0 0.5rem;
}

strong, b {
  color: #2563eb;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 20rem;
  margin: 1rem auto;
  font-size: 1rem;
}
.input-group {
  display: grid;
  grid-template-columns: 10rem 1fr;
  align-items: center;
  gap: 0.5rem;
}

input[type="number"] {
  width: 6rem;
  padding: 0.3rem;
  font-size: 1rem;
}
button {
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  background: #2563eb;
  color: white;
  border: none;
  font-weight: bold;
}
button:hover {
  background: #1d4ed8;
}
button:active {
  transform: translateY(0.15rem) scale(0.98);
  box-shadow: 0 0.15rem 0.3rem rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

input.error {
  border: 2px solid #ef4444;
  background-color: #fee2e2;
  outline: none;
}

.chart-wrap {
  width: min(96vw, 900px);
  height: 55vh;
  min-height: 240px;
  margin: 1.5rem auto;
  padding: 0.5rem;
  background: #ffffffcc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chart { width: 100%; height: 100%; display: block;}

@media (max-width: 600px) {
  .chart-wrap {
    height: 35vh;
    padding: 0.25rem;
  }
  #chart {
    transform: scale(0.9);
    transform-origin: top center;
  }
}

#message {
  white-space: pre-line;
}

p.tight {
  margin-top: 0em;  /* or 0 */
}

