:root {
  color-scheme: light;
  --ink: #171815;
  --paper: #f4f2ed;
  --surface: #fbfaf7;
  --surface-2: #efede7;
  --line: #d7d4cb;
  --line-strong: #aaa69c;
  --text: #181916;
  --muted: #6e716a;
  --accent: #b7f329;
  --accent-deep: #6d9500;
  --danger: #c94f43;
  --success: #267c4b;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px; color: #f8f8f4; background: var(--ink); border-bottom: 1px solid #2f302c;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 34px; height: 34px; display: block;
  background:
    linear-gradient(var(--accent),var(--accent)) 0 0/11px 2px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 0 0/2px 11px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 100% 0/11px 2px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 100% 0/2px 11px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 0 100%/11px 2px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 0 100%/2px 11px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 100% 100%/11px 2px no-repeat,
    linear-gradient(var(--accent),var(--accent)) 100% 100%/2px 11px no-repeat;
}
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .02em; }
.brand p { margin: 3px 0 0; color: #a9aba5; font-size: 12px; }
.format-chip { display: flex; gap: 7px; align-items: center; color: #d9dbd5; font-size: 12px; }
.format-chip span { padding: 7px 10px; border: 1px solid #3b3d37; border-radius: 999px; }
.format-chip span:last-child { color: var(--accent); border-color: #607330; }

main { padding: 18px; }
.workbench {
  min-height: calc(100vh - 112px); display: grid; grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  box-shadow: 0 16px 42px rgba(40, 38, 31, .08);
}
.control-panel { padding: 25px 23px; border-right: 1px solid var(--line); background: #f0eee8; }
.panel-section + .panel-section { margin-top: 28px; }
.section-heading { display: flex; gap: 12px; align-items: flex-start; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.step-number { min-width: 30px; padding-top: 1px; color: var(--accent-deep); font-size: 11px; font-weight: 800; letter-spacing: .08em; }

.drop-zone {
  margin-top: 14px; min-height: 126px; padding: 18px 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px; text-align: center;
  border: 1px dashed #aaa69b; border-radius: 13px; background: #faf9f5;
  transition: border-color .18s, background .18s, transform .18s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: #6d9500; background: #f3f8e4; transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { font-size: 13px; }
.drop-zone span:not(.drop-icon) { color: var(--muted); font-size: 11px; }
.drop-icon { display: grid; place-items: center; width: 32px; height: 32px; color: #111; border-radius: 50%; background: var(--accent); font-size: 22px; font-weight: 300; line-height: 1; }

.selection-summary { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.selection-summary > div { display: flex; flex-direction: column; gap: 3px; }
.selection-summary strong { font-size: 13px; }
.selection-summary span { color: var(--muted); font-size: 11px; }
.text-button { padding: 7px 9px; color: var(--muted); border: 0; background: transparent; }
.text-button:hover { color: var(--text); }
.text-button.danger:hover { color: var(--danger); }

.thumb-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; max-height: 248px; margin-top: 10px;
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.thumb-card {
  position: relative; min-width: 0; aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line);
  border-radius: 9px; background: #d9d7d0; cursor: grab; transition: border-color .15s, transform .15s, opacity .15s;
}
.thumb-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.thumb-card.dragging { opacity: .42; }
.thumb-card.drag-over { outline: 2px solid var(--accent-deep); outline-offset: 1px; }
.thumb-card img { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.thumb-index { position: absolute; left: 5px; top: 5px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; color: #fff; border-radius: 999px; background: rgba(20,21,18,.78); font-size: 10px; font-weight: 750; }
.thumb-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(20,21,18,.72); opacity: 0; }
.thumb-card:hover .thumb-remove, .thumb-remove:focus { opacity: 1; }
.thumb-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 5px; color: #fff; background: linear-gradient(transparent, rgba(15,16,14,.82)); text-align: center; font-size: 10px; }
.thumb-status.processing::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 4px; border: 1px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.thumb-status.done { color: #d8ffa1; }
.thumb-status.error { color: #ffafa6; }
@keyframes spin { to { transform: rotate(360deg); } }

.settings-block { padding-top: 24px; border-top: 1px solid var(--line); }
.range-row { display: flex; justify-content: space-between; margin: 17px 0 9px; font-size: 13px; }
.range-row output { color: var(--accent-deep); font-weight: 750; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: #83b600; }
.range-labels { display: flex; justify-content: space-between; margin-top: 3px; color: #91938c; font-size: 10px; }

.primary-button, .secondary-button, .icon-button { border-radius: 9px; transition: transform .15s, opacity .15s, border-color .15s, background .15s; }
.primary-button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 13px 15px;
  color: #171b0d; border: 1px solid #9fda13; background: var(--accent); font-weight: 760;
}
.primary-button.compact { width: auto; margin: 0; padding: 11px 18px; }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: .38; cursor: not-allowed; }
.secondary-button { padding: 10px 13px; color: var(--text); border: 1px solid var(--line); background: #fff; }
.secondary-button.accent { color: #171b0d; border-color: #a1d827; background: var(--accent); font-weight: 730; }
.icon-button { width: 38px; height: 38px; padding: 0; color: #fff; border: 1px solid #444640; background: #2a2b27; font-size: 24px; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; color: #85877f; }
.privacy-note > span { color: var(--success); }
.privacy-note p { margin: 0; font-size: 11px; line-height: 1.55; }

.workspace-panel { min-width: 0; padding: 27px 30px 42px; background: var(--surface); }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.eyebrow { color: #7c8176; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.workspace-head h2 { margin: 7px 0 4px; font-size: 25px; letter-spacing: -.02em; }
.workspace-head p { margin: 0; color: var(--muted); font-size: 13px; }
.workspace-head p:empty { display: none; }
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.progress-wrap { margin-top: 20px; padding: 13px 15px; border: 1px solid #cad0bc; border-radius: 10px; background: #f4f8e8; }
.progress-copy { display: flex; justify-content: space-between; color: #565c4d; font-size: 12px; }
.progress-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #dfe6ce; }
.progress-track span { display: block; width: 0; height: 100%; background: #7ead08; transition: width .25s; }
.layout-note { display: flex; align-items: center; gap: 11px; margin-top: 20px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f6f5f1; }
.drag-symbol { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: #e7e4dc; font-size: 16px; }
.layout-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.layout-note strong { color: var(--text); font-size: 12px; }

.empty-state { min-height: 570px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 22px 0 6px; color: var(--text); font-size: 17px; }
.empty-state p { margin: 0; font-size: 12px; }
.empty-slide { position: relative; width: 230px; aspect-ratio: 16/9; border: 1px solid #b9b6ad; border-radius: 5px; background: #efede7; box-shadow: 0 12px 25px rgba(42,40,34,.08); }
.empty-slide::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed #c7c3b9; }
.empty-slide span { position: absolute; width: 18%; height: 36%; border-radius: 3px; background: #dad7cf; }
.empty-slide span:nth-child(1) { left: 18%; top: 7%; }.empty-slide span:nth-child(2) { right: 18%; top: 7%; }
.empty-slide span:nth-child(3) { left: 18%; bottom: 7%; }.empty-slide span:nth-child(4) { right: 18%; bottom: 7%; }

.layout-canvas { display: grid; gap: 28px; margin-top: 24px; }
.ppt-page { min-width: 0; }
.page-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.page-label strong { color: var(--text); font-size: 12px; }
.slide-canvas {
  position: relative; width: min(100%, 1080px); aspect-ratio: 16 / 9; overflow: hidden; margin: 0 auto;
  border: 1px solid #cbc8c0; border-radius: 4px; background: #f4f3ef; box-shadow: 0 14px 30px rgba(48,45,37,.11);
}
.slide-canvas::after { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 50%; border-top: 1px dashed rgba(90,90,80,.18); pointer-events: none; }
.layout-item { position: absolute; z-index: 2; cursor: grab; border: 1px solid transparent; transition: filter .15s, opacity .15s, box-shadow .15s; }
.layout-item:hover, .layout-item:focus-within { z-index: 5; border-color: #719900; box-shadow: 0 0 0 2px rgba(183,243,41,.65); }
.layout-item.dragging { opacity: .35; }
.layout-item.drag-over { filter: brightness(.78); box-shadow: 0 0 0 3px var(--accent); }
.layout-item img { width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; }
.order-badge { position: absolute; left: 4px; top: 4px; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 4px; border-radius: 999px; color: #fff; background: rgba(18,19,16,.76); font-size: 9px; font-weight: 800; }
.item-tools { position: absolute; left: 50%; bottom: 6px; display: flex; gap: 3px; padding: 3px; opacity: 0; transform: translateX(-50%); border-radius: 7px; background: rgba(20,21,18,.86); transition: opacity .15s; }
.layout-item:hover .item-tools, .layout-item:focus-within .item-tools { opacity: 1; }
.item-tools button { min-width: 24px; height: 24px; padding: 0 6px; color: #fff; border: 0; border-radius: 5px; background: transparent; font-size: 10px; white-space: nowrap; }
.item-tools button:hover { color: #111; background: var(--accent); }
.issue-list { display: grid; gap: 8px; margin-top: 18px; }
.issue-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.issue-item { align-items: center; flex-wrap: wrap; }
.issue-item button { flex: none; margin-left: auto; }
.issue-item { display: flex; justify-content: space-between; gap: 15px; padding: 11px 13px; border: 1px solid #efc1bd; border-radius: 9px; color: #7b322c; background: #fff4f2; font-size: 12px; }

.editor-dialog { width: min(1180px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: hidden; border: 1px solid #3d3f39; border-radius: 16px; color: #f4f4ef; background: #1b1c19; box-shadow: 0 28px 70px rgba(0,0,0,.35); }
.editor-dialog::backdrop { background: rgba(10,11,9,.78); backdrop-filter: blur(5px); }
.editor-shell { display: flex; flex-direction: column; max-height: calc(100vh - 30px); }
.editor-head, .editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; }
.editor-head { border-bottom: 1px solid #373934; }
.editor-head > div:first-child { min-width: 0; }
.editor-head h2 { max-width: min(720px, calc(100vw - 150px)); margin: 4px 0 2px; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.editor-head p { margin: 0; color: #9da098; font-size: 11px; }
.editor-body { width: 100%; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 260px; overflow: hidden; }
.editor-stage-wrap { min-width: 0; padding: 16px 18px 12px; background: #10110f; }
.editor-stage { position: relative; height: min(65vh, 680px); overflow: hidden; display: grid; place-items: center; background: #080908; touch-action: none; }
.editor-stage img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; user-select: none; pointer-events: none; }
.stage-tip { margin: 9px 0 0; color: #898c84; font-size: 11px; text-align: center; }
.crop-rect { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none; outline: none; }
.crop-rect:focus { box-shadow: 0 0 0 9999px rgba(0,0,0,.55), 0 0 0 2px rgba(183,243,41,.28); }
.crop-grid { position: absolute; pointer-events: none; opacity: .45; }
.crop-grid.vertical { top: 0; bottom: 0; border-left: 1px solid #fff; }.crop-grid.horizontal { left: 0; right: 0; border-top: 1px solid #fff; }
.crop-grid.vertical.one { left: 33.333%; }.crop-grid.vertical.two { left: 66.666%; }.crop-grid.horizontal.one { top: 33.333%; }.crop-grid.horizontal.two { top: 66.666%; }
.handle { position: absolute; width: 24px; height: 24px; border: 0; background: transparent; }
.handle::after { content: ""; position: absolute; left: 7px; top: 7px; width: 8px; height: 8px; border: 2px solid #fff; background: var(--accent); border-radius: 2px; }
.handle.nw { left: -12px; top: -12px; cursor: nwse-resize; }.handle.n { left: 50%; top: -12px; transform: translateX(-50%); cursor: ns-resize; }
.handle.ne { right: -12px; top: -12px; cursor: nesw-resize; }.handle.e { right: -12px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.handle.se { right: -12px; bottom: -12px; cursor: nwse-resize; }.handle.s { left: 50%; bottom: -12px; transform: translateX(-50%); cursor: ns-resize; }
.handle.sw { left: -12px; bottom: -12px; cursor: nesw-resize; }.handle.w { left: -12px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.editor-tools { overflow: auto; padding: 17px; border-left: 1px solid #373934; background: #20211e; }
.tool-label { margin-bottom: 9px; color: #aaaDA5; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.preview-block canvas { width: 100%; height: auto; aspect-ratio: 7 / 9; display: block; border: 1px solid #3e403b; border-radius: 8px; background: #11120f; }
.preview-block p { margin: 8px 0 0; color: #9a9d94; font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.tool-block { margin-top: 21px; padding-top: 18px; border-top: 1px solid #373934; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tool-grid button { padding: 9px 7px; color: #e8e9e4; border: 1px solid #444640; border-radius: 8px; background: #292a26; font-size: 11px; }
.tool-grid button:hover { color: var(--accent); border-color: #728839; }
.crop-advice { margin-top: 18px; padding: 12px; border-radius: 9px; color: #b5b8b0; background: #292a26; }
.crop-advice strong { color: #f2f3ee; font-size: 11px; }
.crop-advice p { margin: 6px 0 0; font-size: 11px; line-height: 1.55; }
.editor-footer { border-top: 1px solid #373934; }
.editor-nav, .editor-save-actions { display: flex; gap: 8px; align-items: center; }
.editor-dialog .secondary-button { color: #ededE8; border-color: #444640; background: #292a26; }
.editor-dialog .text-button { color: #aaaDA5; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; max-width: min(520px, calc(100vw - 30px)); padding: 11px 15px; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); border-radius: 9px; color: #f6f7f2; background: #1c1e1a; box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 13px; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 920px) {
  .topbar { padding: 0 18px; }.format-chip span:first-child { display: none; }
  main { padding: 10px; }.workbench { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .thumb-list { grid-template-columns: repeat(5, 1fr); max-height: none; }
  .workspace-head { align-items: flex-start; flex-direction: column; }.export-actions { justify-content: flex-start; }
  .empty-state { min-height: 360px; }.editor-body { grid-template-columns: 1fr; overflow: auto; }
  .editor-stage { height: 52vh; }.editor-tools { border-left: 0; border-top: 1px solid #373934; }
  .preview-block canvas { width: min(100%, 280px); margin: 0 auto; }.editor-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .brand p { display: none; }.format-chip { display: none; }.thumb-list { grid-template-columns: repeat(4, 1fr); }
  .workspace-panel { padding: 22px 16px 34px; }.control-panel { padding: 22px 18px; }
  .export-actions { width: 100%; }.export-actions button { flex: 1; }
  .editor-head { padding: 14px; }.editor-stage-wrap { padding: 10px; }.editor-tools { padding: 14px; }
  .editor-footer { padding: 13px; }.editor-nav, .editor-save-actions { width: 100%; }.editor-save-actions { justify-content: flex-end; }
}
.task-actions { display: flex; justify-content: flex-end; gap: 16px; margin-top: 10px; }
