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

.shadow-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 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;
}

.control-section {
  padding-top: 24px;
  border-top: 1px solid #d9d3c3;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  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;
}

.stage-label {
  margin-right: 4px;
}

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

.layers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.layer-item {
  display: flex;
  align-items: stretch;
  gap: 4px;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  background: #f4f1e8;
  overflow: hidden;
  transition: border-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.layer-item.is-active {
  border-color: #d8442a;
}

.layer-pick {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 16px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #1c1b18;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}

.layer-swatch {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  background-color: #1c1b18;
  background-image: linear-gradient(45deg, #d9d3c3 25%, transparent 25%), linear-gradient(-45deg, #d9d3c3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d9d3c3 75%), linear-gradient(-45deg, transparent 75%, #d9d3c3 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}

.layer-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.layer-del {
  flex: 0 0 auto;
  padding-inline: 16px;
  font-size: 1rem;
  color: #6b665b;
  background: none;
  border: none;
  border-left: 1px solid #d9d3c3;
  cursor: pointer;
  transition: 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);
}
.layer-del:hover:not(:disabled) {
  color: #f4f1e8;
  background: #d8442a;
}
.layer-del:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.layer-editor {
  gap: 24px;
  padding: 16px;
  background: #f4f1e8;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #1c1b18;
  cursor: pointer;
}
.toggle-row input {
  accent-color: #d8442a;
  cursor: pointer;
}

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

.color-swatch {
  flex: 0 0 auto;
  width: 40px;
  height: 32px;
  padding: 0;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  background: none;
  cursor: pointer;
}
.color-swatch::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 1px;
}

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

.color-hex {
  text-transform: uppercase;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: end;
}

.mini-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b665b;
}
.mini-field .color-swatch {
  width: 100%;
}

.output {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.output .section-rule {
  margin-top: 40px;
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.stage-hint {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #6b665b;
}

.shadow-stage {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 64px;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  transition: background-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.shadow-stage.is-light {
  background: #f4f1e8;
}
.shadow-stage.is-dark {
  background: #1c1b18;
}
.shadow-stage.is-check {
  background-color: #f4f1e8;
  background-image: linear-gradient(45deg, #d9d3c3 25%, transparent 25%), linear-gradient(-45deg, #d9d3c3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d9d3c3 75%), linear-gradient(-45deg, transparent 75%, #d9d3c3 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.shadow-box {
  width: 160px;
  height: 160px;
  background: #f4f1e8;
  border-radius: 12px;
  transition: box-shadow 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), border-radius 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.code-wrap {
  position: relative;
}

.code-block {
  margin: 0;
  padding: 24px;
  padding-right: 132px;
  max-height: 280px;
  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;
}

.code-copy {
  position: absolute;
  top: 16px;
  right: 16px;
}

.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: 860px) {
  .shadow-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}
