:root {
  color-scheme: light;
  font: 16px/1.55 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f1f4f2;
  color: #18231e;
  --line: #d6e0da;
  --accent: #126a50;
  --muted: #53645a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, figure { margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.45rem); line-height: 1.15; letter-spacing: -.04em; }
h2 { font-size: 1.16rem; }
a { color: var(--accent); text-underline-offset: .2em; }
button, input { font: inherit; }
button {
  background: white; color: inherit; border: 1px solid var(--line); border-radius: .7rem;
  cursor: pointer; padding: .55rem .9rem; min-height: 42px;
}
button:disabled { cursor: not-allowed; opacity: .58; }
:where(button, a, input, label):focus-visible, .upload:focus-within { outline: 3px solid #33876a; outline-offset: 3px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: #fff; padding: .8rem max(1rem, calc((100vw - 1100px)/2)); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 800; color: inherit; }
.brand-mark { background: #dff88e; border-radius: .6rem; padding: .25em .45em; font-size: 1.15rem; }
.top-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.key-link {
  border-color: transparent; background: transparent; color: var(--accent);
  text-decoration: underline; text-underline-offset: .2em;
}
.key-link:hover:not(:disabled) { background: #edf6f0; }
.wallet { background: #e8f6ee; color: #075c43; font-weight: 700; }
.workspace { max-width: 1132px; margin: auto; padding: 2.1rem 1rem 3rem; display: grid; gap: 1rem; }
.workspace h1 { margin-bottom: .35rem; }
.surface, .submit-bar { padding: clamp(1rem, 2.7vw, 1.6rem); background: #fff; border: 1px solid var(--line); border-radius: 1rem; }
.minimax-panel {
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  align-items: start; gap: .75rem 2rem; border-color: #b7d5c6; background: #f8fcf9;
}
.minimax-panel h2 { margin-bottom: .3rem; }
.minimax-panel p { color: var(--muted); }
.minimax-panel form { min-width: 0; }
.minimax-panel label { display: block; margin-bottom: .35rem; font-weight: 600; }
.key-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; }
.key-field input {
  width: 100%; min-width: 0; min-height: 44px; border: 1px solid #a9c3b5;
  border-radius: .68rem; color: inherit; background: #fff; padding: .55rem .7rem;
}
.key-primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 700; }
.key-actions { display: flex; gap: .4rem; margin-left: -.55rem; }
#miniMaxStatus:not(:empty) { margin-top: .42rem; }
#miniMaxStatus[data-error="true"] { color: #972626; }
.section-title, .submit-bar, .dialog-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.section-title { margin-bottom: 1rem; }
.switcher { display: flex; flex-wrap: wrap; gap: .25rem; padding: .22rem; border-radius: .72rem; background: #edf3ef; }
.switcher button { border-color: transparent; background: transparent; font-size: .875rem; }
.switcher [aria-pressed="true"] { background: white; border-color: var(--line); color: var(--accent); font-weight: 700; }
.templates, .asset-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.template-card { min-width: 0; }
.template-card button, button.template-card {
  display: grid; gap: .55rem; width: 100%; padding: .38rem; text-align: left; min-width: 0; font-weight: 700;
}
.template-card img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; border-radius: .48rem; background: #e3ebe5; }
.template-card span, .template-card strong { padding-inline: .3rem; }
.template-card a { display: inline-block; margin: .32rem .5rem .05rem; font-size: .875rem; }
.template-card [aria-pressed="true"], button.template-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #f3fbf6; }
[data-panel="douyin"] label { display: block; margin-bottom: .5rem; font-weight: 600; }
#douyinLink { width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: .65rem; padding: .7rem .8rem; color: inherit; }
.asset { min-width: 0; }
.upload {
  display: grid; align-content: center; justify-items: center; min-height: 100px; position: relative;
  border: 1px dashed #a1b6aa; background: #f8fbf9; border-radius: .7rem; padding: .7rem; cursor: pointer;
}
.upload > span { color: var(--accent); font-weight: 700; }
.upload small { color: var(--muted); }
.upload input { position: absolute; height: 1px; width: 1px; opacity: 0; }
.upload:has(input:disabled) { opacity: .65; cursor: not-allowed; }
.asset-preview { display: grid; gap: .5rem; overflow-wrap: anywhere; }
.asset-preview img, .asset-preview video, .task-video, .template-card video {
  display: block; width: 100%; max-height: 330px; background: #101814; object-fit: contain; border-radius: .6rem;
}
.asset-preview img { max-height: 185px; }
.submit-bar { flex-wrap: nowrap; }
#priceText { font-weight: 700; }
#statusText { color: var(--muted); font-size: .875rem; }
#statusText[data-error="true"] { color: #972626; }
.generate { background: #dff88e; border-color: #bed478; font-weight: 800; min-width: 150px; min-height: 48px; }
dialog {
  width: min(540px, calc(100% - 2rem)); max-height: 85dvh; border: 1px solid var(--line);
  border-radius: 1rem; color: inherit; padding: 1.2rem; box-shadow: 0 12px 55px #10271935;
}
dialog::backdrop { background: #13271c91; }
.dialog-title { margin-bottom: .75rem; }
.dialog-title button { min-width: 42px; font-size: 1.15rem; }
.task-row, .ledger-row, .job-item, .ledger-item { border-top: 1px solid var(--line); padding: .75rem 0; }
.ledger-row, .ledger-item { display: flex; justify-content: space-between; gap: .65rem; }
@media (max-width: 600px) {
  .topbar { padding-inline: .75rem; gap: .35rem; }
  .brand { font-size: .875rem; gap: .35rem; }
  .top-actions button { padding-inline: .5rem; font-size: .875rem; }
  .workspace { padding: 1.35rem .75rem 2rem; }
  .minimax-panel { grid-template-columns: 1fr; }
  .templates { grid-template-columns: 1fr; }
  .template-card img { max-height: 230px; }
  .asset-list { gap: .4rem; }
  .upload { padding-inline: .3rem; font-size: .86rem; }
  .generate { min-width: 106px; }
}
