:root {
  color-scheme: light;
  --ink: #1c2321;
  --muted: #6a736c;
  --paper: #f7f4ea;
  --panel: #fffdf6;
  --line: #d8d0bc;
  --accent: #e84d35;
  --blue: #1f6f8b;
  --green: #26835a;
  --shadow: 0 24px 70px rgba(52, 43, 28, 0.16);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: ui-sans-serif, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(90deg, rgba(31, 111, 139, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 111, 139, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(420px, 1fr) 300px;
  gap: 18px;
  min-height: calc(100vh - 48px);
}

.panel,
.palettePanel,
.preview {
  background: rgba(255, 253, 246, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel,
.palettePanel {
  border-radius: 8px;
  padding: 20px;
}

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.mark {
  width: 38px;
  height: 38px;
  display: block;
  background:
    radial-gradient(circle at 50% 50%, transparent 28%, #fffdf6 30%, #fffdf6 42%, transparent 44%),
    conic-gradient(from 20deg, var(--accent), #f0c33c, var(--green), var(--blue), var(--accent));
  border-radius: 50%;
  border: 1px solid rgba(28, 35, 33, 0.18);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

.brand p,
.eyebrow,
small,
.controls span,
.switches {
  color: var(--muted);
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 7px;
  height: 172px;
  border: 1px dashed #9f9277;
  border-radius: 8px;
  background: #fbf1d7;
  cursor: pointer;
  text-align: center;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.dropzone:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #fff0c2;
}

.dropzone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dropIcon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 28px;
  line-height: 1;
}

.controls {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.controls label {
  display: grid;
  gap: 7px;
}

.controls input[type="number"],
.controls select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.controls input[type="range"] {
  accent-color: var(--accent);
}

.switches {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  font-size: 14px;
}

.switches input {
  accent-color: var(--blue);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: var(--ink);
  cursor: pointer;
}

button:nth-child(2) {
  background: var(--blue);
}

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

.previewTop,
.paletteHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 800;
}

.badge {
  min-width: 86px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  background: white;
  font-weight: 700;
}

.boardShell {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
  background: #ece4cf;
}

canvas {
  max-width: 100%;
  height: auto;
  background: white;
  image-rendering: pixelated;
  box-shadow: 0 14px 44px rgba(28, 35, 33, 0.2);
}

.emptyState {
  position: absolute;
  inset: 22px;
  display: grid;
  place-items: center;
  border: 1px dashed #a59a81;
  color: var(--muted);
  background:
    radial-gradient(circle, rgba(232, 77, 53, 0.14) 0 3px, transparent 4px) 0 0 / 22px 22px,
    rgba(255, 253, 246, 0.72);
  font-weight: 700;
}

.paletteList {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  max-height: calc(100vh - 154px);
  overflow: auto;
}

.swatchRow {
  display: grid;
  grid-template-columns: 28px minmax(74px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  font-size: 14px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(28, 35, 33, 0.25);
}

.code {
  font-weight: 800;
}

.symbolBadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.symbolBadge b {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #efe7d0;
  color: var(--ink);
}

.hex {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.name {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 980px) {
  .app {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel,
  .palettePanel,
  .preview {
    box-shadow: 0 12px 34px rgba(52, 43, 28, 0.14);
  }

  .boardShell {
    min-height: 420px;
    justify-content: start;
  }

  canvas {
    max-width: none;
  }

  .paletteList {
    max-height: none;
  }
}
