:root {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #2b211c;
  background: #f6f1ea;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  --accent: #713a2b;
  --muted: #77675d;
  --border: #e9ddd0;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .47; cursor: default; }
button:focus-visible { outline: 3px solid #a97643; outline-offset: 3px; }

.workspace {
  width: min(1170px, 100% - 72px);
  margin: 0 auto;
  padding: 42px 0 44px;
}

.heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.logo {
  position: relative;
  width: 51px;
  height: 51px;
  flex: 0 0 51px;
  border-radius: 13px;
  background: linear-gradient(145deg, #864732, #54271f);
  box-shadow: 0 4px 8px #54271f25;
}

.logo::before, .logo::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 24px;
  border-radius: 3px;
}

.logo::before { border: 1.5px solid #e5be87; transform: rotate(-14deg); top: 15px; left: 13px; }
.logo::after { border: 1.5px solid #f9e7bb; background: #683126; transform: rotate(11deg); top: 12px; left: 22px; }
.heading h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); font-weight: 800; line-height: 1.18; }
.heading p { margin: 7px 0 0; color: var(--muted); }

.studio {
  display: grid;
  grid-template-columns: minmax(360px, .86fr) minmax(0, 1.14fr);
  align-items: stretch;
  gap: 22px;
}

.panel { min-width: 0; border-radius: 19px; }

.controls {
  padding: 25px;
  border: 1px solid var(--border);
  background: #fffdf9;
  box-shadow: 0 8px 36px #3e2a1a08;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 13px;
}

.section-heading h2, .preview-heading h2 {
  font-size: 19px;
  font-weight: 750;
  margin: 0;
  line-height: 1.4;
}

.section-heading span { color: var(--muted); font-size: 12px; }
.uploads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }

.upload {
  position: relative;
  display: flex;
  min-height: 141px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  padding: 12px;
  border: 1px dashed #cbad95;
  border-radius: 12px;
  background: #fbf7f0;
  text-align: center;
  cursor: pointer;
}

.upload:hover, .upload.dragging, .upload:focus-within { background-color: #f8ecdc; border-color: #a97643; }
.upload:focus-within { outline: 2px solid #a97643; outline-offset: 2px; }
.upload:has(input:disabled) { cursor: wait; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: inherit; width: 100%; height: 100%; }
.upload strong { margin-top: 3px; font-size: 14px; }

.upload-image { width: 100%; height: 82px; object-fit: contain; }
.upload-name {
  max-width: 100%;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-icon {
  display: block;
  width: 35px;
  height: 35px;
  margin: 0 auto 1px;
  border-radius: 10px;
  background: #f4e5d4;
  position: relative;
  color: #8a4e32;
}

.upload-icon::before, .upload-icon::after {
  content: "";
  width: 13px;
  height: 1px;
  background: currentColor;
  position: absolute;
  top: 17px;
  left: 11px;
}

.upload-icon::after { transform: rotate(90deg); }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 650;
  transition: background-color .15s;
}

.primary { width: 100%; margin-top: 13px; color: #fff9ef; background: var(--accent); }
.primary:hover:not(:disabled) { background: #592b21; }
.copy { margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--border); }
.title-field { display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 11px; margin-bottom: 9px; font-size: 13px; }
.title-field input { width: 100%; border: 1px solid #e0d4c7; border-radius: 8px; background: #fffdfa; color: inherit; padding: 8px 10px; }
.title-field input::placeholder { color: #7e7067; }
.title-field input:focus { border-color: #a97643; outline: 2px solid #a9764350; }
.outline { width: 100%; margin-top: 3px; background: #fcf6ee; color: #713a2b; border-color: #d9bca4; }
.outline:hover:not(:disabled) { background: #f1e1cf; }
.status { margin: 12px 0 0; overflow-wrap: anywhere; font-size: 13px; color: #604937; }
.status:empty { margin-top: 0; }
.status[data-error="true"] { color: #a02924; }

.preview {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  padding: 22px;
  background: radial-gradient(ellipse at 50% 45%, #4b352c, #2a211d 75%);
  border: 1px solid #382a24;
  color: #fff3db;
  box-shadow: 0 9px 36px #32251720;
}

.preview-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview-heading p { margin: 2px 0 0; color: #cfbca9; font-size: 12px; }
.download { min-height: 38px; background: #f1d3a6; color: #3b2a1f; white-space: nowrap; font-size: 13px; }
.download:hover:not(:disabled) { background: #fce6c1; }
.download-icon { position: relative; width: 13px; height: 13px; border-bottom: 1px solid; }
.download-icon::before { content: ""; position: absolute; top: 0; left: 6px; width: 1px; height: 8px; background: currentColor; }
.download-icon::after { content: ""; position: absolute; top: 3px; left: 4px; border-right: 1px solid; border-bottom: 1px solid; width: 5px; height: 5px; transform: rotate(45deg); }

.preview-viewport { display: grid; place-items: center; min-width: 0; }
.preview-empty, .cover-image {
  width: min(100%, 350px);
  aspect-ratio: 3 / 4;
  border-radius: 8px;
}

.preview-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  border: 1px dashed #937864;
  color: #dbc4ae;
  background: #b0977921;
  font-size: 13px;
}

.preview-empty p { margin: 0; }

.empty-icon {
  position: relative;
  display: block;
  width: 35px;
  height: 29px;
  border: 1px solid #a9927c;
  border-radius: 4px;
  overflow: hidden;
}

.empty-icon::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a9927c;
}

.empty-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: -10px;
  width: 24px;
  height: 24px;
  border: 1px solid #a9927c;
  transform: rotate(45deg);
}

.cover-image { display: block; object-fit: contain; background: #291f1b; box-shadow: 0 10px 32px #170e0a85; }

@media (max-width: 780px) {
  .workspace { width: calc(100% - 32px); padding-top: 26px; }
  .heading { margin-bottom: 19px; gap: 12px; }
  .heading p { font-size: 13px; }
  .studio { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .panel { border-radius: 15px; }
  .controls, .preview { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
