: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;
}
.tool-intro strong {
  color: #1c1b18;
}

.dropzone {
  cursor: pointer;
}

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

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

.sub-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 16px;
  border-left: 2px solid #d9d3c3;
}

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

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

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

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

.logo-pick {
  width: 100%;
  text-align: center;
}

.logo-name {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #6b665b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 108px;
  aspect-ratio: 3/2;
}

.pos-cell {
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  background: #f4f1e8;
  cursor: pointer;
  transition: background-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);
}
.pos-cell:hover {
  border-color: #1c1b18;
}
.pos-cell {
  position: relative;
}
.pos-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d9d3c3;
  transition: background-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.pos-cell.is-active {
  background: #d8442a;
  border-color: #d8442a;
}
.pos-cell.is-active::after {
  background: #f4f1e8;
}

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

.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.wm-stage {
  display: grid;
  place-items: center;
  padding: 24px;
  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;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  overflow: hidden;
}
.wm-stage.is-dragging {
  cursor: grabbing;
}

.wm-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 1px 0 rgba(28, 27, 24, 0.08);
}

.thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thumb {
  position: relative;
  width: 64px;
  height: 64px;
  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);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb:hover {
  border-color: #1c1b18;
}
.thumb.is-active {
  border: 1.5px solid #1c1b18;
  border-color: #d8442a;
}

.thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  color: #f4f1e8;
  background: rgba(28, 27, 24, 0.6);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.thumb-del:hover {
  background: #d8442a;
}

@media (max-width: 860px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}
