: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;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input {
  flex: 0 0 auto;
  width: 44px;
  height: 36px;
  padding: 0;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  background: #f4f1e8;
  cursor: pointer;
}

.hex-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);
}
.hex-input:focus {
  outline: none;
  border-color: #d8442a;
}
.hex-input.is-invalid {
  border-color: #d8442a;
}

.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;
}

.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-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 6px 6px 0 rgba(28, 27, 24, 0.12);
}

.swatch {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-height: 116px;
  padding: 8px;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.swatch:hover {
  transform: translateY(-3px);
}
.swatch.is-base {
  box-shadow: inset 0 4px 0 var(--color-ink);
}

.swatch-step {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.swatch-hex {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  text-transform: uppercase;
}

.harmony-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.harmony-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.harmony-card:hover {
  border-color: #1c1b18;
}

.harmony-chip {
  height: 72px;
}

.harmony-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  background: #ece7d9;
}

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

.harmony-hex {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #1c1b18;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.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-strip {
    grid-template-columns: repeat(5, 1fr);
  }
}
