:root {
  color-scheme: light;
  --bg: #f0f3f7;
  --panel: #ffffff;
  --text: #1a2433;
  --muted: #52627a;
  --border: #d5deea;
  --canvas: #e6ebf3;
  --accent: #0d5bd7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, #ffffff 0%, #f4f7fb 36%, transparent 60%),
    linear-gradient(160deg, #e9eef7 0%, #f2f5fa 50%, #e5edf7 100%);
  color: var(--text);
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 28px;
}

h1 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

button {
  border: 1px solid #adc2e5;
  background: linear-gradient(180deg, #f8fbff 0%, #eaf2ff 100%);
  border-radius: 9px;
  color: #113a84;
  font-weight: 700;
  cursor: pointer;
  height: 38px;
  min-width: 72px;
  padding: 0 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.thresholdLabel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text);
}

#thresholdRange {
  width: min(280px, 58vw);
}

#thresholdValue {
  min-width: 2.8ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.status {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.94rem;
}

#asciiCanvas {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--canvas);
  display: block;
}

@media (max-width: 700px) {
  .app {
    padding: 14px 10px 20px;
  }

  .controls {
    gap: 8px;
    padding: 10px;
  }

  h1 {
    font-size: 1.15rem;
  }
}
