:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --line: #d5dae3;
  --soft: #f0f2f6;
  --text: #262730;
  --muted: #5c6370;
  --accent: #ff4b4b;
  --link: #0068c9;
  --ok: #09ab3b;
  --warn: #ffbd45;
  --danger: #ff4b4b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(49, 51, 63, 0.06);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans Pro", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  line-height: 1.45;
}
a { color: var(--link); text-decoration: none; }
button, .btn, input, select, textarea { font: inherit; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 20px 6px;
}
.mpt-brand {
  min-width: 0;
  margin: 0;
  padding: 0;
  line-height: 1.15;
}
.mpt-brand > span:first-child {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-width: 0;
}
.mpt-brand__name {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}
.mpt-brand__version {
  flex: 0 0 auto;
  font-size: 1rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.72;
  text-decoration: none;
  white-space: nowrap;
}
.mpt-brand__version:hover { opacity: 1; text-decoration: underline; text-underline-offset: 0.18em; }
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  min-height: 40px;
}
.ghost:hover { border-color: #b9c0cc; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ico { width: 16px; height: 16px; flex: 0 0 auto; }
.spark { width: 18px; height: 18px; color: var(--muted); }
.chev::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 6px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; vertical-align: middle; }
.lang {
  min-width: 180px;
  background: var(--soft);
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 40px;
}
main { padding: 8px 16px 48px; }
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px 16px;
  min-width: 0;
  box-shadow: none;
}
.card h3 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
}
.field { margin: 0 0 12px; }
.field-label-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.875rem;
  margin-bottom: 6px;
}
.help-inline { color: var(--muted); font-size: 0.8rem; }
.linkish {
  margin-left: auto;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--link);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.25rem;
}
.linkish:hover { text-decoration: underline; text-underline-offset: 0.15rem; }
label {
  display: block;
  font-size: 0.875rem;
  color: var(--text);
  margin: 0 0 12px;
}
label .help {
  color: var(--muted);
  cursor: help;
  margin-left: 4px;
}
input[type="text"], input[type="search"], select, textarea {
  width: 100%;
  margin-top: 6px;
  background: var(--soft);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235c6370' d='M1.2 1.4L6 6.2l4.8-4.8'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
textarea { resize: vertical; min-height: 120px; }
.field textarea { min-height: 96px; }
textarea[name="video_script"] { min-height: 180px; }
textarea[name="video_terms"] { min-height: 72px; }
input[type="range"] { width: 100%; padding: 0; height: 22px; accent-color: var(--accent); }
input[type="color"] {
  width: 72px;
  height: 48px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  accent-color: var(--accent);
}
.check { display: flex; align-items: center; margin-bottom: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.slider-val { color: var(--accent); font-size: 13px; float: right; }
details.advanced { margin: 8px 0 12px; border: 0; background: transparent; }
details.advanced summary {
  cursor: pointer;
  color: var(--text);
  list-style: none;
  min-height: 2.25rem;
  padding: 0.35rem 0.25rem;
  opacity: 0.78;
  font-size: 0.9rem;
  font-weight: 500;
}
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before { content: "▸ "; color: var(--muted); }
details.advanced[open] summary::before { content: "▾ "; }
details.advanced[open] summary { opacity: 1; background: color-mix(in srgb, currentColor 5%, transparent); border-radius: 4px 4px 0 0; }
details.advanced[open] { background: color-mix(in srgb, currentColor 5%, transparent); border-radius: 4px; padding-bottom: 8px; }
.ai-btn, .secondary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  margin: 0 0 12px;
}
.ai-btn:hover, .secondary:hover { border-color: #b9c0cc; }
.seg {
  display: flex;
  flex-wrap: nowrap;
  background: var(--soft);
  border-radius: 10px;
  padding: 4px;
  margin: 6px 0 12px;
}
.seg button {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
}
.seg button.active {
  background: #fff;
  box-shadow: 0 0 0 1px var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #31333f;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 40;
  font-size: 14px;
}
.actions { margin: 14px 0 18px; }
#submit-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
#submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.status-card, .preview-card { margin-top: 12px; }
.bar { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff4b4b, #09ab3b); }
#status-text { margin: 10px 0 6px; }
#log {
  background: var(--soft);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
}
.preview-card video { width: 100%; max-height: 640px; background: #000; border-radius: 10px; }
.preview-actions { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.task-list { display: grid; gap: 10px; }
.task {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.5fr auto;
  gap: 10px;
  align-items: center;
  background: var(--soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.task b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-preview {
  background: transparent;
  border: 0;
  color: var(--link);
  cursor: pointer;
  padding: 0;
}
.ok { color: var(--ok); }
.warn { color: #b54708; }
.err { color: var(--danger); }
.hidden, [hidden] { display: none !important; }
.popover {
  position: absolute;
  right: 20px;
  top: 64px;
  width: min(860px, calc(100vw - 48px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 30;
}
.popover.open { display: block; }
.popover h3 { margin: 0 0 12px; }
.ghost[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.seo-block { margin: 20px 20px 0; }
.seo-block h2 { font-size: 1.15rem; margin: 0 0 12px; }
.seo-block h3 { font-size: 1rem; margin: 16px 0 6px; }
.seo-block p, .seo-block li { color: var(--muted); margin: 0 0 8px; line-height: 1.65; }
.seo-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 8px;
}
.seo-facts div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.seo-facts strong { display: block; font-size: 1.05rem; }
.seo-facts span { color: var(--muted); font-size: 13px; }
.seo-block pre.code { margin: 8px 0 0; }
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  padding: 18px 20px 32px;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .mpt-brand__name { font-size: 2rem; }
}
@media (max-width: 700px) {
  .seo-facts { grid-template-columns: 1fr 1fr; }
  .grid, .row, .task, .bg-row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .mpt-brand > span:first-child, .mpt-brand { gap: 0.45rem; }
  .mpt-brand__name { font-size: 1.875rem; }
  .mpt-brand__version { font-size: 0.875rem; }
  .popover { right: 12px; left: 12px; width: auto; top: 112px; }
  .lang { min-width: 140px; }
}
@media (max-width: 480px) {
  .mpt-brand__name { font-size: 1.5rem; }
  .mpt-brand__version { font-size: 0.75rem; }
}
