:root{
  /* SAMPLE (blue family) */
  --blue:#2563EB;          /* sample mean x̄ */
  --blue-hover:#1D4ED8;    /* buttons etc */
  --blue-soft:#3b82f6;     /* CI band */

  /* POPULATION (soft greys) */
  --pop:#94a3b8;           /* population curve */
  --pop-mean:#64748b;      /* μ dashed line */

  /* OTHER */
  --ink:#0f172a;           /* sample dots */
  --muted:#64748b;
  --grid:#e2e8f0;
  --bg:#ffffff;
}

*{box-sizing:border-box}

body{
  margin:0;
  font:16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Noto Sans","Liberation Sans",sans-serif;
  color:var(--ink);
  background:var(--bg);
}

.container{
  max-width:1100px;
  margin:0 auto;
  padding:16px;
}

.header h1{
  margin:0 0 4px 0;
  font-size:1.6rem;
}
.subtitle{
  margin:0;
  color:var(--muted);
}

/* -------------------- Controls -------------------- */

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* four equal columns */
  gap: 16px;
  align-items: start;   /* align the tops of all controls */
  margin: 16px 0;
}

/* Medium screens (tablets / small laptops) */
@media (max-width: 900px) {
  .controls {
    grid-template-columns: repeat(2, 1fr); /* two columns */
  }
}

/* Small screens (mobiles) */
@media (max-width: 550px) {
  .controls {
    grid-template-columns: 1fr; /* single column */
  }
}

/* Right-align Sample button inside its column */
.controls .control:last-child {
  text-align: right;
}

/* Labels - tighter spacing for better alignment */
.control label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;   /* tighter spacing */
  line-height: 1.2;
}

/* Input boxes and selects - consistent height */
.control input[type="number"],
.control select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  font: inherit;
  height: 40px;         /* matches the Sample button height */
}

.control input[type="range"] {
  width: 100%;
  margin-top: 4px;
}

/* Range slider styling */
input[type="range"]{
  width:100%;
  appearance:none;
  background:transparent;
  height:32px;
}
input[type="range"]::-webkit-slider-runnable-track{
  height:6px;
  background:var(--grid);
  border-radius:999px;
}
input[type="range"]::-moz-range-track{
  height:6px;
  background:var(--grid);
  border-radius:999px;
}
input[type="range"]::-webkit-slider-thumb{
  appearance:none;
  margin-top:-6px;
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--blue);
  border:2px solid white;
  box-shadow:0 0 0 2px var(--blue);
}
input[type="range"]::-moz-range-thumb{
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--blue);
  border:2px solid white;
  box-shadow:0 0 0 2px var(--blue);
}


/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:10px;
  border:1px solid transparent;
  cursor:pointer;
}
.btn-primary{
  background:var(--blue);
  color:#fff;
}
.btn-primary:hover{
  background:var(--blue-hover);
}

#sampleBtn {
  height: 40px;           /* same as .input-lg */
  padding: 0 48px;        /* similar horizontal padding */
  font-size: 0.95rem;     /* same text size */
  border-radius: 8px;     /* matches the select box */
  display: inline-flex;   
  align-items: center;    /* vertically centre the text */
  justify-self: end;
}

/* -------------------- Layers -------------------- */
.layers {
  margin: 8px 0 4px;
  font-size: 0.9rem;     /* slightly smaller text */
}

.layers h2 {
  font-size: 0.95rem;    /* smaller heading */
  margin: 0 0 4px;
}

.layers ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));  /* narrower cards */
  gap: 4px;               /* tighter spacing */
}

.layers li {
  padding: 4px 6px;       /* smaller card padding */
  border: 1px solid var(--grid);
  border-radius: 6px;
  background: #fff;
}

.layers input[type="checkbox"] {
  transform: scale(0.9);  /* smaller checkbox */
  margin-right: 4px;
}

/* -------------------- Figure -------------------- */
.figure{
  background:#fff;
  border:1px solid var(--grid);
  border-radius:12px;
  padding:8px;
  margin-top:8px;
}

.footer{
  margin-top:12px;
  color:var(--muted);
}

svg{
  width:100%;
  height:auto;
  display:block;
}

/* -------------------- Plot elements -------------------- */
.grid line{
  stroke:#e5e7eb;
  stroke-width:1;
}

.axis{
  stroke:#0f172a;
  stroke-width:1.2;
}

/* tick marks */
.tickline {
  stroke:#0f172a;
  stroke-width:1;
}

/* tick labels */
.tick {
  fill:#475569;
  font-size:12px;
}

.pop-curve{
  fill:none;
  stroke:var(--pop);
  stroke-width:2;
}

.pop-mean{
  stroke:var(--pop-mean);
  stroke-width:2;
  stroke-dasharray:4 4;
}

.sample-point{
  fill:var(--ink);
  opacity:.9;
}

.sample-mean{
  stroke:var(--blue);
  stroke-width:2.5;
}

.ci-band{
  stroke:var(--blue-soft);
  stroke-width:6;
}

.ci-cap{
  stroke:var(--blue-soft);
  stroke-width:3;
}

.label{
  fill:#111827;
  font-size:12px;
}

.mono{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
}

/* Larger select/input styling */
.input-lg{
  height:40px;
  padding:0 12px;
  font-size:0.95rem;
  border-radius:8px;
}
