:root {
  color-scheme: dark;
  --page: #061018;
  --panel: rgba(8, 25, 37, 0.94);
  --panel-soft: rgba(12, 35, 48, 0.88);
  --text: #dce9e6;
  --text-strong: #f4f7f3;
  --muted: #a7b8b4;
  --muted-soft: #819996;
  --line: rgba(126, 214, 201, 0.27);
  --mint: #86dac7;
  --mint-2: #5fcbb8;
  --font-sans: "Inter", "SF Pro Text", "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 84% 6%, rgba(22, 154, 164, 0.28), transparent 30%),
    radial-gradient(circle at 7% 75%, rgba(15, 126, 77, 0.25), transparent 32%),
    linear-gradient(135deg, #061018 0%, #041119 52%, #061d18 100%);
  font-family: var(--font-sans);
}

button, input, select { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }

.tool-shell {
  width: min(100% - 40px, 1160px);
  margin: 0 auto;
  padding: 24px 0 36px;
}

.tool-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(7, 22, 32, 0.8);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-logo { width: 52px; height: 52px; object-fit: contain; }
.brand-lockup span { display: grid; gap: 4px; }
.brand-lockup strong { color: var(--text-strong); font-size: 19px; }
.brand-lockup small { color: var(--muted); font-size: 12px; }

.back-link, .tool-footer a {
  color: var(--mint);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.back-link:hover, .tool-footer a:hover { color: #b0f3e4; }

.tool-intro {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 42px auto 28px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--mint);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tool-intro h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.16;
}

.tool-intro > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.tool-intro .privacy-notice {
  display: flex;
  max-width: 760px;
  align-items: center;
  gap: 8px;
  color: #9fe7d6;
  font-size: 13px;
}

.privacy-notice svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.editor-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), transparent 35%),
    var(--panel);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.23), inset 0 1px 0 rgba(234, 255, 247, 0.05);
}

.panel-heading, .list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 6px 0 0;
  color: var(--text-strong);
  font-size: 21px;
}

.count-label, .format-label {
  padding: 7px 10px;
  border: 1px solid rgba(134, 218, 199, 0.25);
  border-radius: 999px;
  color: var(--mint);
  background: rgba(134, 218, 199, 0.07);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.drop-zone {
  display: grid;
  min-height: 164px;
  justify-items: center;
  align-content: center;
  gap: 8px;
  margin-top: 22px;
  padding: 20px;
  border: 1px dashed rgba(134, 218, 199, 0.5);
  border-radius: 19px;
  color: var(--muted);
  background: rgba(10, 35, 47, 0.6);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-dragging {
  border-color: var(--mint);
  outline: none;
  background: rgba(22, 66, 73, 0.45);
}

.drop-zone.is-disabled { opacity: 0.52; cursor: not-allowed; }
.drop-zone.is-disabled:hover, .drop-zone.is-disabled:focus-visible { border-color: rgba(134, 218, 199, 0.5); background: rgba(10, 35, 47, 0.6); }

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(134, 218, 199, 0.34);
  border-radius: 14px;
  color: var(--mint);
  background: rgba(134, 218, 199, 0.1);
  font-size: 27px;
  line-height: 1;
}

.drop-zone strong { color: var(--text-strong); font-size: 15px; }
.drop-zone > span:last-child { font-size: 12px; }

.list-heading { margin: 22px 0 10px; }
.list-heading h3 { margin: 0; color: var(--text-strong); font-size: 14px; }

.text-button {
  padding: 5px 8px;
  border: 0;
  color: var(--mint);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.text-button:disabled { color: var(--muted-soft); cursor: default; }

.image-list {
  display: grid;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.image-item {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(126, 214, 201, 0.16);
  border-radius: 13px;
  background: rgba(12, 35, 48, 0.76);
  cursor: grab;
}

.image-item:active { cursor: grabbing; }
.image-order { color: var(--mint); font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.image-thumbnail { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #031018; }
.image-name { min-width: 0; overflow: hidden; color: var(--text-strong); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.image-item-controls { display: inline-flex; gap: 3px; }

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(126, 214, 201, 0.18);
  border-radius: 8px;
  color: var(--mint);
  background: rgba(134, 218, 199, 0.05);
  font-size: 15px;
  cursor: pointer;
}

.icon-button:hover:not(:disabled) { border-color: rgba(134, 218, 199, 0.48); background: rgba(134, 218, 199, 0.12); }
.icon-button:disabled { color: var(--muted-soft); opacity: 0.44; cursor: default; }

.image-list:empty::before {
  display: block;
  padding: 11px 12px;
  border: 1px solid rgba(126, 214, 201, 0.13);
  border-radius: 13px;
  color: var(--muted-soft);
  content: "还没有添加图片";
  font-size: 12px;
}

.control-field { display: grid; gap: 8px; margin-top: 20px; }
.control-field label { color: var(--text-strong); font-size: 13px; font-weight: 650; }

.control-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(126, 214, 201, 0.25);
  border-radius: 13px;
  color: var(--text-strong);
  background: #0c202d;
}

.field-hint { margin: 0; color: var(--muted-soft); font-size: 12px; line-height: 1.55; }

.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 740;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  color: #05201b;
  background: linear-gradient(135deg, #a5efdd, #60ceb9);
  box-shadow: 0 11px 28px rgba(46, 233, 189, 0.16);
}

.primary-button:hover:not(:disabled) { filter: brightness(1.06); }
.primary-button:disabled { opacity: 0.48; cursor: not-allowed; }

.material-panel > .primary-button, .material-panel > .secondary-button { width: 100%; margin-top: 18px; }

.secondary-button {
  border-color: rgba(134, 218, 199, 0.32);
  color: var(--text-strong);
  background: rgba(134, 218, 199, 0.08);
}

.progress-region { min-height: 46px; padding-top: 12px; }
.progress-region progress { width: 100%; height: 8px; accent-color: var(--mint-2); }
.status-message { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.status-message[data-state="error"] { color: #ffac9f; }
.status-message[data-state="success"] { color: var(--mint); }

.video-stage {
  display: grid;
  width: min(100%, 340px);
  min-height: 390px;
  place-items: center;
  margin: 20px auto 0;
  overflow: hidden;
  border: 1px solid rgba(126, 214, 201, 0.21);
  border-radius: 20px;
  background: #041019;
}

.preview-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted-soft);
  text-align: center;
}

.preview-placeholder strong { color: var(--muted); font-size: 14px; }
.preview-placeholder > span:last-child { font-size: 12px; }

.play-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  padding-left: 4px;
  border: 1px solid rgba(134, 218, 199, 0.3);
  border-radius: 50%;
  color: var(--mint);
  background: rgba(134, 218, 199, 0.08);
}

#videoPreview { display: block; width: 100%; max-height: min(70vh, 590px); object-fit: contain; background: #000; }
.download-button { width: 100%; margin-top: 17px; }
.preview-hint { margin-top: 10px; text-align: center; }

.tool-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  color: var(--muted-soft);
  font-size: 12px;
  text-align: center;
}

:focus-visible { outline: 3px solid rgba(134, 218, 199, 0.72); outline-offset: 3px; }

@media (max-width: 820px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-panel { padding: 22px; }
  .video-stage { min-height: 320px; }
}

@media (max-width: 520px) {
  .tool-shell { width: min(100% - 24px, 1160px); padding-top: 12px; }
  .tool-header { min-height: 66px; padding: 8px 13px; border-radius: 19px; }
  .brand-logo { width: 42px; height: 42px; }
  .brand-lockup { gap: 8px; }
  .brand-lockup strong { font-size: 16px; }
  .brand-lockup small { font-size: 10px; }
  .back-link { font-size: 12px; white-space: nowrap; }
  .tool-intro { gap: 10px; margin: 30px auto 20px; }
  .tool-intro > p:not(.eyebrow) { font-size: 14px; }
  .tool-intro .privacy-notice { align-items: flex-start; font-size: 12px; text-align: left; }
  .editor-grid { gap: 14px; }
  .editor-panel { padding: 17px; border-radius: 20px; }
  .video-stage { min-height: 300px; }
  .tool-footer { flex-wrap: wrap; }
}
