:root {
  color-scheme: light;
  --ink: #26334a;
  --muted: #66718a;
  --line: #d9e2ec;
  --paper: #ffeaea;
  --panel: #ffffff;
  --accent: #748dae;
  --accent-dark: #526a8c;
  --accent-soft: #9ecad6;
  --pink: #f5cbcb;
  --shadow: 0 18px 50px rgba(82, 106, 140, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  overflow-x: hidden;
}

.workspace {
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--paper);
  min-height: 0;
  overflow: auto;
}

.canvas-shell {
  width: min(76vh, 92vw, 760px);
  aspect-ratio: 1;
  padding: 14px;
  background: #eef8fa;
  border: 1px solid rgba(158, 202, 214, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: #edf6f8;
  cursor: grab;
  touch-action: none;
}

canvas:active {
  cursor: grabbing;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 32px 28px;
  background: var(--panel);
  border-left: 1px solid rgba(116, 141, 174, 0.22);
  min-height: 0;
  overflow-y: auto;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p,
.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.follow-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 14px;
  padding: 0 14px;
  border: 1px solid rgba(116, 141, 174, 0.38);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(116, 141, 174, 0.13);
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: #3d4d68;
  font-size: 14px;
  font-weight: 700;
}

textarea,
select,
.layer-item input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

select,
.file-picker {
  min-height: 44px;
  padding: 0 12px;
}

.text-layers {
  display: grid;
  gap: 10px;
}

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

.section-head span {
  color: #3d4d68;
  font-size: 14px;
  font-weight: 700;
}

.section-head button,
.layer-item button {
  min-height: 34px;
  border: 1px solid rgba(116, 141, 174, 0.32);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.section-head button {
  padding: 0 12px;
}

.section-head button:disabled,
.layer-item button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.layer-list {
  display: grid;
  gap: 8px;
}

.layer-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.layer-item.is-active {
  border-color: rgba(116, 141, 174, 0.78);
  box-shadow: 0 0 0 3px rgba(158, 202, 214, 0.26);
}

.layer-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef8fa;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.layer-item input {
  height: 38px;
  padding: 0 10px;
}

.layer-item button {
  padding: 0;
}

.file-picker {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  overflow: hidden;
  cursor: pointer;
}

.file-picker::before {
  content: "选择";
  flex: 0 0 auto;
  margin-right: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #eef8fa;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #e5edf4;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(82, 106, 140, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #e5edf4;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(82, 106, 140, 0.25);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.position-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6fbfc;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526078;
  cursor: pointer;
}

.segmented button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 7px rgba(116, 141, 174, 0.22);
}

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

.actions button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.actions button:last-child {
  background: var(--accent-dark);
}

@media (max-width: 860px) {
  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .workspace {
    min-height: auto;
    padding: 18px;
    overflow: visible;
  }

  .canvas-shell {
    width: min(94vw, 620px);
    padding: 8px;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 22px 16px 28px;
  }
}

@media (max-width: 480px) {
  .grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: 1fr;
  }
}
