:root {
  --color-paper: #f4f1e8;
  --color-paper-deep: #ece7d9;
  --color-ink: #1c1b18;
  --color-ink-soft: #6b665b;
  --color-line: #d9d3c3;
  --color-accent: #d8442a;
  --color-accent-deep: #b0331d;
  --color-mark: #e0a92e;
  --font-display: Inter, Noto Sans TC, sans-serif;
  --font-body: Inter, Noto Sans TC, sans-serif;
  --font-mono: Inter, Noto Sans TC, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.tool-intro {
  max-width: 64ch;
  margin-block: 24px 40px;
  color: #6b665b;
}

.editor-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #ece7d9;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
}

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

.control-label {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b665b;
}

.control-label-value {
  font-variant-numeric: tabular-nums;
  color: #1c1b18;
  text-transform: none;
}

.text-input {
  width: 100%;
  min-width: 0;
  padding: 8px 16px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: #1c1b18;
  background: #f4f1e8;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  transition: border-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.text-input:focus {
  outline: none;
  border-color: #d8442a;
}

.range-input {
  width: 100%;
  accent-color: #d8442a;
  cursor: pointer;
}

.step-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 4px 16px;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  color: #6b665b;
  background: #f4f1e8;
  cursor: pointer;
  transition: color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), border-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), background-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.chip:hover {
  color: #1c1b18;
  border-color: #1c1b18;
}
.chip.is-active {
  color: #f4f1e8;
  background: #d8442a;
  border-color: #d8442a;
}

.ratio-custom {
  width: 92px;
  flex: 0 0 auto;
  padding: 4px 8px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  text-align: center;
  color: #1c1b18;
  background: #f4f1e8;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
}
.ratio-custom:focus {
  outline: none;
  border-color: #d8442a;
}

.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 24px;
  border-top: 1px solid #d9d3c3;
}

.output {
  min-width: 0;
}
.output .section-rule:first-child {
  margin-top: 0;
}

.scale-preview {
  display: flex;
  flex-direction: column;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  overflow: hidden;
  background: #f4f1e8;
  box-shadow: 6px 6px 0 rgba(28, 27, 24, 0.12);
}

.scale-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid #d9d3c3;
}
.scale-row:last-child {
  border-bottom: none;
}
.scale-row.is-base {
  background: #ece7d9;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.scale-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: center;
}

.scale-name {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #1c1b18;
}

.scale-val {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #6b665b;
  font-variant-numeric: tabular-nums;
}

.scale-sample {
  min-width: 0;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  line-height: 1.1;
  color: #1c1b18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-block {
  margin: 0;
  padding: 24px;
  max-height: 360px;
  overflow: auto;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #1c1b18;
  background: #ece7d9;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  white-space: pre;
  tab-size: 2;
}

.copy-hint {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #d8442a;
}

@media (max-width: 720px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .scale-row {
    grid-template-columns: 108px minmax(0, 1fr);
    padding: 16px;
  }
}
