:root {
  font:
    15px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: #252a28;
  background: #f6f5f1;
  --accent: #267562;
  --line: #e4e3dd;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  max-width: 1440px;
  margin: auto;
  padding: 28px 34px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
h1 {
  font-size: 25px;
  line-height: 1.2;
  margin: 3px 0;
}
header p {
  margin: 6px 0;
  color: #737974;
}
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
main {
  max-width: 1440px;
  margin: auto;
  padding: 0 34px 34px;
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 20px;
}
.panel,
.workspace {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.panel {
  padding: 19px;
  align-self: start;
}
.panel section + section {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}
h2 {
  font-size: 15px;
  margin: 0 0 13px;
  display: flex;
  justify-content: space-between;
}
h2 small,
.hint,
.toolbar span,
.export-size {
  font-size: 12px;
  color: #818780;
  font-weight: 400;
}
.upload {
  display: block;
  border: 1px dashed #a9bdb4;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
}
.upload span {
  display: block;
  color: #7a827d;
  font-size: 11px;
  font-weight: 400;
  margin-top: 3px;
}
.items {
  padding: 0;
  list-style: none;
  margin: 10px 0 0;
  display: grid;
  gap: 10px;
}
.items li {
  position: relative;
  padding: 0 0 10px;
  border-bottom: 1px solid #f0f0ec;
}
.thumb-wrap {
  position: relative;
  width: 100%;
  height: 154px;
  overflow: hidden;
  border-radius: 9px;
  background: #efeee9;
  touch-action: none;
  cursor: grab;
}
.thumb-wrap:active {
  cursor: grabbing;
}
.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.order-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #202925d9;
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.delete {
  position: absolute;
  right: 7px;
  top: 7px;
  border: 0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  background: #fff;
  color: #303834;
  font-size: 18px;
  cursor: pointer;
}
.items input[type="text"] {
  display: block;
  width: 100%;
  border: 1px solid #e4e5e1;
  border-radius: 7px;
  padding: 8px;
  margin-top: 7px;
  font: 13px system-ui;
}
.items input[type="range"] {
  width: 48%;
  vertical-align: middle;
}
.choices {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.choices button,
.secondary,
.primary {
  border-radius: 8px;
  padding: 8px 10px;
  font: 600 12px system-ui;
  cursor: pointer;
}
.choices button {
  border: 1px solid #dfe2dd;
  background: white;
  color: #4f5752;
}
.choices button[aria-pressed="true"] {
  border-color: #78a999;
  background: #edf5f1;
  color: #246956;
}
.choices.compact button {
  padding: 6px 9px;
}
.sub-label {
  display: block;
  font-size: 12px;
  color: #737974;
  margin: 12px 0 6px;
}
.ratio-group {
  margin-top: 10px;
}
.hint {
  margin: 8px 0 0;
}
.actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.primary,
.secondary {
  padding: 9px 13px;
  font-size: 13px;
}
.primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}
.secondary {
  background: white;
  border: 1px solid #d8ddd8;
  color: #343c37;
}
.primary:disabled,
.secondary:disabled,
.choices button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.export-size {
  display: block;
  margin-top: 8px;
}
.errors {
  font-size: 12px;
  color: #9b3c2f;
  white-space: pre-line;
  margin-top: 6px;
}
.errors:empty {
  display: none;
}
.workspace {
  min-width: 0;
  min-height: 620px;
  display: flex;
  flex-direction: column;
}
.toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.toolbar div {
  display: flex;
  gap: 14px;
  align-items: center;
}
.stage {
  position: relative;
  flex: 1;
  min-height: 570px;
  padding: 22px;
  display: grid;
  place-items: center;
  background: #f3f2ee;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}
.stage.dragover {
  outline: 3px dashed #267562;
  outline-offset: -12px;
}
canvas {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 24px #252a281c;
}
.empty {
  text-align: center;
  color: #707873;
}
.empty-icon {
  font-size: 48px;
  color: #9bb8ac;
}
.empty strong {
  color: #303834;
}
.empty p {
  font-size: 13px;
}
.empty[hidden] {
  display: none;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
.upload:focus-visible {
  outline: 3px solid #91c6b5;
  outline-offset: 2px;
}
.items li.dragging {
  opacity: 0.45;
}
.items li.drop-target {
  border-color: #267562;
}
@media (max-width: 800px) {
  header {
    padding: 20px 16px;
  }
  main {
    padding: 0 12px 20px;
    grid-template-columns: 1fr;
  }
  .workspace {
    grid-row: 1;
    min-height: 430px;
  }
  .stage {
    min-height: 380px;
  }
  .panel {
    grid-row: 2;
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar div {
    display: block;
  }
  .toolbar span {
    display: block;
  }
  .thumb-wrap {
    height: 190px;
  }
}
.style-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.style-card {
  display: grid !important;
  justify-items: center;
  gap: 2px;
  min-width: 0 !important;
  padding: 7px 4px !important;
}
.style-card span {
  font-size: 17px;
}
.style-card small {
  font-size: 10px;
  color: #747c77;
}
.outline-sample span {
  font-family: Impact, "Arial Black", sans-serif;
  color: white;
  -webkit-text-stroke: 1px #202624;
  text-shadow:
    1px 1px #202624,
    -1px -1px #202624;
}
.subtitle-sample span {
  background: #303633;
  color: white;
  padding: 0 5px;
  border-radius: 2px;
}
.plain-sample span {
  font-weight: 700;
  color: #202724;
}
.focus-controls {
  display: flex;
  gap: 12px;
  margin: 7px 3px 0;
}
.focus-controls input {
  flex: 1;
  min-width: 0;
}
.thumb-wrap {
  user-select: none;
  -webkit-user-select: none;
}
.workspace{align-self:start;position:sticky;top:16px;height:calc(100vh - 170px);min-height:420px;max-height:900px}.stage{min-height:0}.items{max-height:45vh;overflow-y:auto;padding-right:4px}.thumb-wrap{height:110px}@media(max-width:800px){.workspace{position:static;height:420px;min-height:420px;max-height:none}.stage{min-height:0}.items{max-height:45vh}.thumb-wrap{height:150px}}
/* Explicit two-axis fit: a long canvas must not determine the stage's minimum size. */
.workspace{overflow:hidden}
.stage{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0}
.stage canvas{flex:none;max-width:100%;max-height:100%;min-width:0;min-height:0;object-fit:contain}
.corner-choices{margin-top:8px;gap:4px}
.corner-choices button{font-size:11px;padding:5px 8px}
.toolbar{flex-shrink:0}
/* Readable 1:1 preview, with scrolling for long or wide compositions. */
.stage{display:block;overflow:auto;scrollbar-gutter:stable;overscroll-behavior:contain}
.stage canvas{width:auto;height:auto;max-width:none;max-height:none;margin:0 auto;object-fit:initial}
.stage .empty{padding:70px 0}
.stage{scrollbar-color:#aab7b0 #ebece8}
.stage::-webkit-scrollbar{width:12px;height:12px}
.stage::-webkit-scrollbar-track{background:#ebece8}
.stage::-webkit-scrollbar-thumb{background:#aab7b0;border:3px solid #ebece8;border-radius:8px}
.preview-controls{display:flex!important;gap:5px!important;flex-wrap:wrap;flex-shrink:0}
.preview-controls button{font:600 12px system-ui;padding:6px 9px;border:1px solid #dfe2dd;border-radius:7px;background:white;color:#4f5752;cursor:pointer}
.preview-controls button[aria-pressed=true]{border-color:#78a999;background:#edf5f1;color:#246956}
.toolbar{align-items:center;gap:10px;flex-wrap:wrap}
.stage.overview-mode{display:flex;align-items:center;justify-content:center;overflow:hidden;scrollbar-gutter:auto}
.file-drag .upload,.file-drag .stage{outline:3px dashed #267562;outline-offset:-5px;background-color:#edf5f1}
[hidden]{display:none!important}
.mode-choices{display:grid;grid-template-columns:1fr 1fr}
.mode-choices button{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:12px 9px}
.mode-choices strong{font-size:15px}.mode-choices small{font-size:10px;font-weight:400}
.mode-section .hint{line-height:1.7}
.focus-controls:before{content:'取景';font-size:11px;color:#818780;white-space:nowrap;align-self:center}
.items textarea{display:block;width:100%;resize:vertical;min-height:76px;border:1px solid #e4e5e1;border-radius:7px;padding:8px;margin-top:7px;font:13px/1.6 system-ui}
textarea:focus-visible{outline:3px solid #91c6b5;outline-offset:2px}

.stage canvas.crop-enabled{touch-action:none;cursor:grab}.stage canvas.panning{cursor:grabbing}
.focus-controls:before{content:none}.focus-controls{align-items:center;gap:8px;font-size:11px;color:#737974}.focus-controls input{width:auto!important}.focus-controls output{min-width:38px}
.crop-hint{padding:0 18px 10px;margin:8px 0 0;flex-shrink:0}
.icon{width:19px;height:19px;display:inline-block;vertical-align:middle;flex-shrink:0}
[data-icon]{display:inline-flex;align-items:center}
.choices button,.secondary,.primary,.preview-controls button{display:inline-flex;align-items:center;justify-content:center;gap:7px}
h1{display:flex;align-items:center;gap:10px;font-size:23px}h1 .icon{width:25px;height:25px}
.header-tools{display:flex;align-items:center;gap:12px}.language-picker{display:flex;align-items:center;gap:6px;color:#68736c}.language-picker select{font:13px system-ui;color:inherit;border:1px solid var(--line);background:white;border-radius:8px;padding:8px 5px;max-width:112px}
.mode-choices button{flex-direction:row;align-items:center;justify-content:center;font-size:14px}.mode-choices .icon{width:22px;height:22px}
.upload{display:flex;align-items:center;justify-content:center;gap:10px;padding:18px 8px}.upload>span{margin:0;font-size:14px;font-weight:600;color:var(--accent)}
.panel section+section{margin-top:15px;padding-top:14px}.choices{gap:5px}.choices button{padding:8px;font-size:12px}.choices button .icon{width:18px;height:18px}
.focus-controls .icon{width:17px;height:17px}.focus-controls .scale-icon{display:flex;align-items:center}.focus-controls input{accent-color:var(--accent)}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.empty{display:flex;flex-direction:column;align-items:center;gap:20px}.empty>.icon{width:62px;height:62px;color:#a7bcb2}.stage .empty{padding:50px 0}
.order-badge{padding:0;border:0;cursor:grab}.order-badge .icon{width:14px;height:14px}.delete{display:grid;place-items:center}.delete .icon{width:16px;height:16px}
@media(max-width:800px){header{gap:12px;flex-wrap:wrap}.header-tools{gap:8px}h1{font-size:19px}.toolbar{padding:10px}.toolbar .preview-controls button{font-size:11px}}
