:root[data-theme="dark"]{
  --bg:#1A1D1F; --surface:#232728; --surface-alt:#2C3133;
  --text:#EDEFEE; --text-muted:#94999A;
  --accent:#39D081; --accent-ink:#0A1712;
  --success:#39D081; --danger:#FF7A7A;
  --border:rgba(255,255,255,0.08);
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg); color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"PingFang TC","Noto Sans TC",sans-serif;
  -webkit-font-smoothing:antialiased;
}
.display{ font-family:"Space Grotesk",-apple-system,sans-serif; }
.frame{
  max-width:480px; margin:0 auto; min-height:100vh;
  background:var(--bg); position:relative; display:flex; flex-direction:column;
}
@media (min-width:481px){
  body{ background:#111314; }
  .frame{ box-shadow:0 0 60px rgba(0,0,0,0.5); }
}
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:blur(10px); border-bottom:1px solid var(--border);
}
.brand{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:18px; }
.brand-mark{ width:26px; height:26px; border-radius:8px; background:var(--accent); flex-shrink:0; }
.points-pill{
  display:flex; align-items:center; gap:6px;
  background:var(--surface); border:1px solid var(--border);
  padding:6px 12px; border-radius:999px; font-weight:600; font-size:14px; cursor:pointer;
}
.points-pill .dot{ width:7px; height:7px; border-radius:50%; background:var(--accent); }
.admin-badge{
  font-size:11px; font-weight:700; padding:5px 11px; border-radius:999px;
  background:var(--surface-alt); color:var(--text-muted); border:1px solid var(--border);
}
.pages{ flex:1; padding-bottom:100px; }
.page{ display:none; padding:18px; animation:fadeUp .28s ease; }
.page.active{ display:block; }
@keyframes fadeUp{ from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:none;} }
h1.page-title{ font-size:22px; margin:4px 0 6px; }
.page-sub{ font-size:13px; color:var(--text-muted); margin:0 0 18px; line-height:1.55; }
h2.section-title{
  font-size:13px; font-weight:700; margin:26px 0 10px;
  color:var(--text-muted); letter-spacing:.04em;
  display:flex; align-items:center; gap:8px;
}
h2.section-title .n{
  width:20px; height:20px; border-radius:6px; background:var(--accent); color:var(--accent-ink);
  display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700;
}
.upload-zone{
  border:1.5px dashed var(--border); border-radius:18px;
  background:var(--surface); padding:22px 16px; text-align:center;
  cursor:pointer; transition:border-color .2s;
}
.upload-zone:active{ border-color:var(--accent); }
.upload-icon{
  width:42px; height:42px; margin:0 auto 10px; border-radius:12px;
  background:var(--surface-alt); display:flex; align-items:center; justify-content:center;
}
.upload-icon svg{ width:20px; height:20px; stroke:var(--accent); fill:none; stroke-width:1.8; }
.upload-title{ font-size:14px; font-weight:700; }
.upload-hint{ font-size:12px; color:var(--text-muted); margin-top:4px; }
.upload-zone.filled{ padding:0; border-style:solid; text-align:left; overflow:hidden; }
.upload-stage{
  height:190px; background:var(--surface-alt);
  display:flex; align-items:center; justify-content:center;
  position:relative;
}
.upload-stage img{
  max-width:100%; max-height:100%;
  width:auto; height:auto;
  object-fit:contain; display:block; border-radius:4px;
}
.upload-remove{
  position:absolute; top:10px; right:10px;
  width:30px; height:30px; border-radius:50%;
  background:rgba(0,0,0,.6); color:#fff; border:none;
  font-size:14px; cursor:pointer; backdrop-filter:blur(4px);
}
.upload-filebar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; background:var(--surface);
}
.upload-filename{ font-size:13px; font-weight:700; }
.upload-filemeta{ font-size:12px; color:var(--text-muted); }
.composer{
  background:var(--surface); border:1px solid var(--border);
  border-radius:20px; padding:16px; margin-top:12px;
}
.composer textarea{
  width:100%; border:none; outline:none; resize:none; background:transparent;
  color:var(--text); font-size:16px; line-height:1.5; min-height:60px; font-family:inherit;
}
.composer textarea::placeholder{ color:var(--text-muted); }
.select-row{ display:flex; gap:8px; margin-top:10px; }
.select-row.four-cols{ flex-wrap:wrap; }
.select-row.four-cols .select-wrap{ flex:1 1 calc(50% - 4px); }
.select-wrap{ flex:1; min-width:0; }
.select-label{ font-size:11px; color:var(--text-muted); margin-bottom:5px; font-weight:700; }
.select-shell{ position:relative; }
.select-shell select{
  width:100%; appearance:none; -webkit-appearance:none;
  background:var(--surface-alt); border:1px solid var(--border); border-radius:12px;
  padding:10px 28px 10px 12px; font-size:13px; font-weight:700;
  color:var(--text); font-family:inherit; cursor:pointer;
}
.select-shell svg{
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  width:14px; height:14px; stroke:var(--text-muted); fill:none; stroke-width:2; pointer-events:none;
}
.composer-footer{
  display:flex; align-items:center; justify-content:space-between;
  margin-top:14px; padding-top:14px; border-top:1px solid var(--border);
}
.cost-note{ font-size:13px; color:var(--text-muted); }
.cost-note strong{ color:var(--text); }
.btn{ border:none; cursor:pointer; font-weight:700; font-size:15px; border-radius:14px; padding:12px 22px; font-family:inherit; }
.btn-primary{
  background:var(--accent); color:var(--accent-ink);
  box-shadow:0 6px 18px -6px color-mix(in srgb, var(--accent) 65%, transparent);
  transition:transform .12s ease;
}
.btn-primary:active{ transform:scale(.97); }
.btn-primary:disabled,.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; }
.btn-block{ width:100%; }
.btn-ghost{ background:var(--surface-alt); color:var(--text); border:1px solid var(--border); }
.btn-danger-ghost{ background:transparent; color:var(--danger); border:1px solid var(--border); }
.result-stage{
  margin-top:12px; border-radius:20px; border:1px solid var(--border);
  background:var(--surface); aspect-ratio:1/1; overflow:hidden;
  display:flex; align-items:center; justify-content:center; position:relative;
}
.result-stage.video-stage{ aspect-ratio:16/9; }
.result-stage img{ width:100%; height:100%; object-fit:cover; display:block; }
.stage-empty{ text-align:center; color:var(--text-muted); font-size:13px; padding:20px; }
.stage-empty .big{ font-size:26px; display:block; margin-bottom:8px; opacity:.5; }
.play-overlay{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.play-overlay span{
  width:52px; height:52px; border-radius:50%; background:rgba(0,0,0,.55);
  display:flex; align-items:center; justify-content:center; color:#fff; font-size:18px;
  backdrop-filter:blur(4px);
}
.stage-toolbar{ display:flex; gap:8px; margin-top:10px; }
.stage-toolbar button{ flex:1; padding:11px; border-radius:13px; font-size:14px; }
.developing{
  position:relative; width:100%; height:100%; overflow:hidden;
  background:
    repeating-linear-gradient(45deg,
      color-mix(in srgb, var(--accent) 5%, transparent) 0 6px,
      transparent 6px 12px),
    var(--surface-alt);
}
.developing::before{
  content:""; position:absolute; left:0; right:0; height:36%;
  background:linear-gradient(to bottom, transparent,
    color-mix(in srgb, var(--accent) 22%, transparent) 55%,
    color-mix(in srgb, var(--accent) 60%, transparent) 88%,
    color-mix(in srgb, var(--accent) 95%, transparent));
  animation:scan 1.8s cubic-bezier(.4,0,.35,1) infinite;
}
@keyframes scan{ 0%{transform:translateY(-120%);} 100%{transform:translateY(340%);} }
.developing-label{
  position:absolute; left:0; right:0; bottom:0; padding:10px 12px;
  display:flex; align-items:center; justify-content:space-between;
  font-size:11px; font-weight:700; color:var(--text);
  background:linear-gradient(to top, color-mix(in srgb, var(--bg) 88%, transparent), transparent);
  z-index:2;
}
.developing-bar{
  position:absolute; left:0; bottom:0; height:3px; width:0%;
  background:var(--accent); z-index:3; box-shadow:0 0 10px var(--accent);
  transition:width .3s linear;
}
.thumb-developing .developing-label{ display:none; }
.history-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.history-item{ display:flex; flex-direction:column; gap:5px; }
.history-thumb{
  aspect-ratio:1/1; border-radius:12px; overflow:hidden;
  background:var(--surface-alt); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; position:relative;
}
.history-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.history-thumb.selected{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
.thumb-play{
  position:absolute; bottom:4px; right:4px; width:16px; height:16px;
  border-radius:50%; background:rgba(0,0,0,.6); color:#fff;
  font-size:8px; display:flex; align-items:center; justify-content:center;
}
.history-actions{ display:flex; gap:4px; }
.history-actions button{
  flex:1; padding:5px 0; font-size:11px; font-weight:700;
  border-radius:8px; border:1px solid var(--border);
  background:var(--surface); color:var(--text-muted); cursor:pointer; font-family:inherit;
}
.history-actions button.act-del{ color:var(--danger); }
.history-actions button:active{ transform:scale(.94); }
.pager{ display:flex; align-items:center; justify-content:center; gap:6px; margin-top:14px; }
.pager button{
  min-width:32px; height:32px; padding:0 8px; border-radius:10px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--text-muted); font-size:13px; font-weight:700; cursor:pointer; font-family:inherit;
}
.pager button.current{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.pager button:disabled{ opacity:.35; }
.learn-card{
  background:var(--surface); border:1px solid var(--border);
  border-radius:18px; padding:16px; margin-bottom:14px;
}
.learn-label{ font-size:13px; font-weight:700; margin-bottom:4px; }
.learn-help{ font-size:12px; color:var(--text-muted); line-height:1.55; margin-bottom:12px; }
.term-input{
  width:100%; padding:14px 16px; border-radius:14px;
  border:1px solid var(--border); background:var(--surface-alt);
  color:var(--text); font-size:17px; font-weight:700; font-family:inherit; outline:none;
}
.term-input::placeholder{ color:var(--text-muted); font-weight:400; }
.term-input:focus{ border-color:var(--accent); }
.batch-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.batch-cell{
  aspect-ratio:1/1; border-radius:12px; overflow:hidden;
  border:1px solid var(--border); position:relative; background:var(--surface-alt);
}
.batch-cell img{ width:100%; height:100%; object-fit:cover; display:block; }
.batch-cell .x{
  position:absolute; top:3px; right:3px; width:18px; height:18px; border-radius:50%;
  background:rgba(0,0,0,.65); color:#fff; font-size:10px;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.batch-add{
  aspect-ratio:1/1; border-radius:12px; border:1.5px dashed var(--border);
  display:flex; align-items:center; justify-content:center;
  color:var(--accent); font-size:22px; cursor:pointer; background:transparent;
}
.batch-count{ font-size:12px; color:var(--text-muted); margin-top:10px; }
.guide-img{
  width:100%; border-radius:10px; display:block; cursor:zoom-in;
  object-fit:contain; background:var(--surface-alt);
}
.balance-hero{
  background:
    radial-gradient(120% 140% at 50% -20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--surface);
  border:1px solid var(--border); border-radius:22px; padding:24px 20px; text-align:center;
}
.balance-hero .label{ font-size:13px; color:var(--text-muted); }
.balance-hero .number{ font-size:44px; font-weight:700; margin:6px 0; }
.balance-hero .unit{ font-size:16px; color:var(--text-muted); margin-left:4px; }
.tier-badge{
  display:inline-block; margin-top:6px; font-size:12px; font-weight:600;
  padding:4px 10px; border-radius:999px; background:var(--surface-alt); color:var(--text-muted);
}
.plan-row{ display:flex; gap:10px; overflow-x:auto; padding:4px 2px 8px; scrollbar-width:none; }
.plan-row::-webkit-scrollbar{ display:none; }
.plan-card{
  flex-shrink:0; width:140px; background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:14px; position:relative;
}
.plan-card.recommended{ border-color:var(--accent); }
.plan-card .tag{
  position:absolute; top:-9px; right:12px; background:var(--accent); color:var(--accent-ink);
  font-size:11px; font-weight:700; padding:2px 8px; border-radius:999px;
}
.plan-points{ font-size:20px; font-weight:700; margin:2px 0; }
.plan-price{ font-size:13px; color:var(--text-muted); margin-bottom:10px; }
.plan-card button{ width:100%; padding:8px; font-size:13px; border-radius:10px; }
.history-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 0; border-bottom:1px solid var(--border);
}
.history-row:last-child{ border-bottom:none; }
.history-left{ display:flex; gap:10px; align-items:center; }
.history-icon{
  width:36px; height:36px; border-radius:10px; background:var(--surface-alt);
  display:flex; align-items:center; justify-content:center; font-size:14px;
}
.history-title{ font-size:14px; font-weight:600; }
.history-time{ font-size:12px; color:var(--text-muted); margin-top:2px; }
.history-amount{ font-size:14px; font-weight:700; }
.amount-pos{ color:var(--success); }
.settings-list{ background:var(--surface); border:1px solid var(--border); border-radius:16px; overflow:hidden; }
.settings-item{
  display:flex; align-items:center; justify-content:space-between;
  padding:15px 16px; font-size:14px; font-weight:600;
  border-bottom:1px solid var(--border); cursor:pointer;
}
.settings-item:last-child{ border-bottom:none; }
.settings-item .chev{ color:var(--text-muted); }
.settings-value{ font-size:13px; color:var(--text-muted); font-weight:400; }
.tabbar{
  position:fixed; bottom:0; left:0; right:0; max-width:480px; margin:0 auto;
  background:color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter:blur(12px); border-top:1px solid var(--border);
  display:flex; padding:8px 4px calc(8px + env(safe-area-inset-bottom)); z-index:20;
}
.tab-item{
  flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
  padding:6px 0; color:var(--text-muted); cursor:pointer; font-size:11px; font-weight:600;
}
.tab-item.active{ color:var(--text); }
.tab-item.active svg{ stroke:var(--accent); }
.tab-item svg{ width:22px; height:22px; stroke:currentColor; fill:none; stroke-width:1.8; }
.sheet-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,0.55);
  display:none; align-items:flex-end; justify-content:center; z-index:50;
}
.sheet-overlay.active{ display:flex; }
.sheet{
  width:100%; max-width:480px; background:var(--surface);
  border-radius:22px 22px 0 0; padding:10px 20px calc(20px + env(safe-area-inset-bottom));
  animation:slideUp .25s ease;
}
@keyframes slideUp{ from{transform:translateY(100%);} to{transform:translateY(0);} }
.sheet-handle{ width:36px; height:4px; background:var(--border); border-radius:99px; margin:6px auto 16px; }
.sheet h3{ margin:0 0 16px; font-size:17px; }
.field{ margin-bottom:12px; }
.field:last-child{ margin-bottom:0; }
.field label{ display:block; font-size:12px; color:var(--text-muted); margin-bottom:6px; font-weight:600; }
.field input, .field select{
  width:100%; padding:12px 14px; border-radius:12px; border:1px solid var(--border);
  background:var(--surface-alt); color:var(--text); font-size:15px; outline:none; font-family:inherit;
}
.field input:focus{ border-color:var(--accent); }
.field-hint{ font-size:11px; color:var(--text-muted); margin-top:5px; }
.card{
  background:var(--surface); border:1px solid var(--border);
  border-radius:18px; padding:16px; margin-bottom:14px;
}
.card-title{ font-size:14px; font-weight:700; margin-bottom:2px; }
.card-desc{ font-size:12px; color:var(--text-muted); margin-bottom:12px; line-height:1.5; }
.input-with-toggle{ position:relative; }
.input-with-toggle input{ padding-right:64px; }
.toggle-visibility{
  position:absolute; right:8px; top:50%; transform:translateY(-50%);
  background:var(--surface); border:1px solid var(--border); border-radius:8px;
  padding:5px 10px; font-size:11px; font-weight:700; color:var(--text-muted); cursor:pointer;
}
.save-row{ display:flex; align-items:center; justify-content:space-between; margin-top:16px; gap:10px; }
.save-status{ font-size:12px; color:var(--text-muted); }
.save-status.saved{ color:var(--success); }
.rate-row{ display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.rate-row input{ flex:1; text-align:center; }
.rate-eq{ color:var(--text-muted); font-size:13px; flex-shrink:0; }
.rate-unit{ font-size:12px; color:var(--text-muted); flex-shrink:0; width:34px; }
.plan-list{ display:flex; flex-direction:column; gap:10px; }
.plan-row-admin{
  display:flex; align-items:center; gap:8px;
  background:var(--surface-alt); border:1px solid var(--border);
  border-radius:14px; padding:10px 12px;
}
.plan-row-admin input{ background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:8px 10px; font-size:13px; width:100%; }
.plan-row-admin .lab{ font-size:11px; color:var(--text-muted); margin-bottom:4px; display:block; }
.plan-row-admin .col{ flex:1; min-width:0; }
.plan-row-admin .del{
  width:30px; height:30px; border-radius:9px; border:1px solid var(--border);
  background:var(--surface); color:var(--danger); flex-shrink:0; cursor:pointer;
}
.add-plan-btn{
  width:100%; padding:10px; border-radius:12px; border:1.5px dashed var(--border);
  background:transparent; color:var(--accent); font-weight:700; font-size:13px; cursor:pointer; margin-top:10px;
}
.model-item{
  display:flex; align-items:center; gap:12px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:14px; margin-bottom:10px;
}
.model-icon{
  width:42px; height:42px; border-radius:12px; background:var(--surface-alt);
  display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0;
}
.model-body{ flex:1; min-width:0; }
.model-name{ font-size:14px; font-weight:700; }
.model-meta{ font-size:12px; color:var(--text-muted); margin-top:2px; }
.model-tag{
  display:inline-block; font-size:10px; font-weight:700; padding:2px 7px; border-radius:999px;
  margin-top:6px; background:var(--surface-alt); color:var(--text-muted);
}
.model-tag.type-img{ color:#8FD3FF; }
.model-tag.status-training{ color:var(--accent-ink); background:var(--accent); font-weight:700; }
.switch{ position:relative; width:44px; height:26px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.switch .track{
  position:absolute; inset:0; background:var(--surface-alt); border:1px solid var(--border);
  border-radius:999px; cursor:pointer; transition:background .2s;
}
.switch .thumb{
  position:absolute; top:2px; left:2px; width:20px; height:20px; border-radius:50%;
  background:var(--text-muted); transition:transform .2s, background .2s;
}
.switch input:checked + .track{ background:color-mix(in srgb, var(--accent) 30%, var(--surface-alt)); border-color:var(--accent); }
.switch input:checked + .track .thumb{ transform:translateX(18px); background:var(--accent); }
.switch input:disabled + .track{ opacity:.45; cursor:not-allowed; }
.scope-banner{
  display:flex; align-items:center; gap:10px;
  background:color-mix(in srgb, var(--accent) 12%, var(--surface));
  border:1px solid var(--accent); border-radius:14px; padding:12px 14px; margin-bottom:16px;
}
.scope-banner .ico{ font-size:18px; }
.scope-banner .txt{ font-size:12px; line-height:1.5; color:var(--text); }
.scope-banner .txt strong{ color:var(--accent); }
.toast{
  position:fixed; left:50%; bottom:112px; transform:translateX(-50%) translateY(10px);
  background:var(--surface); color:var(--text);
  border:1px solid var(--border); border-left:3px solid var(--accent);
  padding:13px 16px; border-radius:14px; font-size:13px; font-weight:600;
  box-shadow:0 14px 36px rgba(0,0,0,.45);
  opacity:0; pointer-events:none; transition:opacity .22s, transform .22s;
  z-index:80; width:88%; max-width:420px; text-align:center; line-height:1.5;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.toast.info{ text-align:left; }
.toast.warn{ border-left-color:var(--danger); }
.toast .t-title{ display:block; margin-bottom:6px; color:var(--accent); }
.toast .t-body{ display:block; font-weight:400; color:var(--text-muted); font-size:12.5px; }
.lightbox{
  position:fixed; inset:0; background:rgba(0,0,0,.78);
  display:none; align-items:center; justify-content:center; z-index:90; padding:20px;
}
.lightbox.active{ display:flex; }
.lightbox img{ max-width:100%; max-height:78vh; object-fit:contain; border-radius:12px; }
.lightbox .lb-meta{
  position:absolute; left:0; right:0; bottom:24px; text-align:center;
  color:#fff; font-size:13px; font-weight:700;
}
.account-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--surface-alt); border:1px solid var(--border);
  border-radius:14px; padding:12px; margin-bottom:8px;
}
.account-row .name{ font-size:14px; font-weight:700; }
.account-row .meta{ font-size:12px; color:var(--text-muted); }
.account-row.off{ opacity:.55; }
.url-box{
  display:flex; align-items:center; gap:8px;
  background:var(--surface-alt); border:1px solid var(--border);
  border-radius:12px; padding:10px 12px; margin-bottom:8px;
}
.url-box code{ flex:1; font-size:12px; color:var(--text); word-break:break-all; }
.copy-btn{
  border:1px solid var(--border); background:var(--surface); color:var(--accent);
  border-radius:8px; padding:6px 10px; font-size:11px; font-weight:700; cursor:pointer;
}
.login-wrap{ padding:48px 22px 32px; }
.login-card{ background:var(--surface); border:1px solid var(--border); border-radius:22px; padding:24px 20px; }
.closed-wrap{ padding:80px 22px; text-align:center; }
.hidden-file{ display:none; }
.busy{ pointer-events:none; }

/* ===== 2026-10-15：串接真實生成 ===== */
.result-stage img, .result-stage video{ width:100%; height:100%; object-fit:contain; display:block; background:#0f1112; }
.result-stage img{ cursor:zoom-in; }
.history-thumb video{ width:100%; height:100%; object-fit:cover; display:block; pointer-events:none; }
.history-thumb.thumb-failed{ display:flex; align-items:center; justify-content:center; background:color-mix(in srgb, var(--danger) 10%, var(--surface-alt)); border-color:color-mix(in srgb, var(--danger) 35%, var(--border)); cursor:pointer; }
.history-thumb.thumb-failed span{ font-size:12px; font-weight:700; color:var(--danger); }
.api-test{ font-size:12px; line-height:1.7; margin-top:10px; border-radius:12px; padding:0; }
.api-test.good, .api-test.bad{ padding:10px 12px; border:1px solid var(--border); background:var(--surface-alt); }
.api-test.good{ border-color:color-mix(in srgb, var(--accent) 45%, transparent); }
.api-test.bad{ border-color:color-mix(in srgb, var(--danger) 45%, transparent); color:var(--text); }
.api-test .sub{ color:var(--text-muted); margin-top:4px; }
/* 修正：計費匯率的兩個輸入框在手機上把頁面撐寬（原本沒有樣式） */
.rate-row input{ min-width:0; width:0; padding:10px 8px; border-radius:12px; border:1px solid var(--border); background:var(--surface-alt); color:var(--text); font-size:14px; outline:none; font-family:inherit; }
.rate-row input:focus{ border-color:var(--accent); }

/* ===== 2026-10-15d：API 測試台 ===== */
.balance-grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px; }
.balance-grid > div{ background:var(--surface-alt); border:1px solid var(--border); border-radius:12px; padding:10px 12px; }
.balance-grid .lab{ display:block; font-size:11px; color:var(--text-muted); margin-bottom:4px; }
.balance-grid b{ font-family:"Space Grotesk",-apple-system,sans-serif; font-size:18px; }
details.raw{ margin-top:10px; }
details.raw summary{ font-size:12px; color:var(--text-muted); cursor:pointer; padding:4px 0; }
pre.json{ margin:6px 0 0; padding:10px; border-radius:10px; background:#111314; border:1px solid var(--border); color:#cfe9da; font-size:11px; line-height:1.5; white-space:pre-wrap; word-break:break-all; max-height:320px; overflow:auto; }
.seg{ display:flex; gap:6px; margin-bottom:12px; }
.seg button{ flex:1; padding:10px; border-radius:12px; border:1px solid var(--border); background:var(--surface-alt); color:var(--text-muted); font-weight:700; font-family:inherit; cursor:pointer; }
.seg button.on{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.c-upload{ border:1.5px dashed var(--border); border-radius:12px; min-height:56px; display:flex; align-items:center; justify-content:center; gap:10px; padding:8px; cursor:pointer; color:var(--text-muted); font-size:13px; background:var(--surface-alt); }
.c-upload img{ max-height:120px; max-width:60%; border-radius:8px; object-fit:contain; }
.c-upload .x{ font-size:12px; color:var(--danger); border:1px solid var(--border); border-radius:8px; padding:4px 8px; }
.c-textarea{ width:100%; padding:10px 12px; border-radius:12px; border:1px solid var(--border); background:var(--surface-alt); color:var(--text); font-size:14px; font-family:inherit; resize:vertical; outline:none; }
.c-textarea.mono{ font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12px; margin-top:6px; }
.c-params{ display:grid; grid-template-columns:1fr 1fr; gap:0 8px; }
.c-params .field{ min-width:0; }
.c-status{ font-size:13px; margin-top:10px; color:var(--text-muted); min-height:18px; }
.c-status.bad{ color:var(--danger); }
.c-status.good{ color:var(--accent); }
.c-preview img, .c-preview video{ width:100%; max-height:420px; object-fit:contain; border-radius:12px; background:#0f1112; margin-top:8px; display:block; }
.c-preview a{ font-size:12px; color:var(--accent); word-break:break-all; }
.model-list{ display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.model-list span{ font-size:11px; padding:4px 8px; border-radius:999px; background:var(--surface-alt); border:1px solid var(--border); cursor:pointer; }
.c-log{ font-size:12px; color:var(--text-muted); }
.c-log .row{ display:flex; justify-content:space-between; gap:8px; padding:8px 0; border-bottom:1px solid var(--border); }
.c-log .row:last-child{ border-bottom:none; }
.c-log .row b{ color:var(--text); font-weight:600; }
.c-log .ok{ color:var(--accent); } .c-log .ng{ color:var(--danger); }
.c-log button{ font-size:11px; padding:3px 8px; border-radius:8px; border:1px solid var(--border); background:var(--surface-alt); color:var(--text); cursor:pointer; }
#bal-msg{ margin-bottom:12px; line-height:1.5; }

/* ===== 2026-10-15e：真人素材、模型下拉 ===== */
.person-box{ background:var(--surface-alt); border:1px solid var(--border); border-radius:14px; padding:12px 12px 2px; margin-bottom:12px; }
.person-box select{ background:var(--surface); }
.quota-row{ font-size:13px; font-weight:700; margin-bottom:12px; font-family:"Space Grotesk",-apple-system,sans-serif; }
.verify-box{ margin-top:12px; padding:12px; border-radius:14px; border:1px solid var(--accent); background:color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.verify-link{ font-size:11px; word-break:break-all; background:#111314; border-radius:10px; padding:8px 10px; margin:6px 0 10px; color:#cfe9da; max-height:90px; overflow:auto; }
.verify-box .c-params{ gap:8px; }
.people{ margin-top:12px; }
.people .row{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 0; border-bottom:1px solid var(--border); font-size:13px; }
.people .row:last-child{ border-bottom:none; }
.people .row small{ display:block; color:var(--text-muted); font-size:11px; margin-top:2px; word-break:break-all; }
.people .row button{ font-size:12px; padding:6px 10px; border-radius:9px; border:1px solid var(--border); background:var(--surface-alt); color:var(--danger); cursor:pointer; flex-shrink:0; }
#c-model, #c-person, .c-params select, #c-size, #c-format{ width:100%; padding:11px 12px; border-radius:12px; border:1px solid var(--border); background:var(--surface-alt); color:var(--text); font-size:14px; font-family:inherit; }

/* ===== 2026-10-15f：測試台左右排版、多張圖片、餘額與預估 ===== */
body.wide .frame{ max-width:1240px; }
.money-bar{ display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:8px; align-items:stretch; margin-bottom:6px; }
.money-bar > div{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:10px 12px; min-width:0; }
.money-bar .lab{ display:block; font-size:11px; color:var(--text-muted); margin-bottom:3px; }
.money-bar b{ font-family:"Space Grotesk",-apple-system,sans-serif; font-size:18px; white-space:nowrap; }
.mb-refresh{ width:44px; border-radius:14px; border:1px solid var(--border); background:var(--surface); color:var(--text); font-size:18px; cursor:pointer; }
.console-grid{ display:grid; grid-template-columns:1fr; gap:14px; margin-top:12px; }
.console-right .result-card{ margin-bottom:14px; }
@media (min-width:960px){
  .console-grid{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:start; }
  .console-right{ position:sticky; top:74px; }
  .console-right .c-preview img, .console-right .c-preview video{ max-height:62vh; }
}
.seg-sm button{ padding:8px 4px; font-size:12px; }
.multi-grid{ display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; }
.multi-cell{ position:relative; aspect-ratio:1/1; border-radius:12px; overflow:hidden; border:1px solid var(--border); background:var(--surface-alt); }
.multi-cell img{ width:100%; height:100%; object-fit:cover; display:block; }
.multi-cell .n{ position:absolute; left:4px; top:4px; font-size:10px; font-weight:700; background:rgba(0,0,0,.65); color:#fff; border-radius:6px; padding:1px 5px; }
.multi-cell .x{ position:absolute; right:4px; top:4px; width:20px; height:20px; border-radius:50%; background:rgba(0,0,0,.65); color:#fff; font-size:11px; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.multi-cell.loading{ display:flex; align-items:center; justify-content:center; font-size:11px; color:var(--text-muted); }
.multi-add{ aspect-ratio:1/1; border-radius:12px; border:1.5px dashed var(--border); display:flex; align-items:center; justify-content:center; color:var(--accent); font-size:24px; cursor:pointer; background:transparent; }
.multi-add.off{ opacity:.35; cursor:not-allowed; }
.run-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:14px; padding-top:14px; border-top:1px solid var(--border); }
.run-est{ font-size:13px; color:var(--text-muted); }
.run-est b{ color:var(--text); }
.preview-empty{ border:1.5px dashed var(--border); border-radius:12px; min-height:180px; display:flex; align-items:center; justify-content:center; color:var(--text-muted); font-size:13px; margin-top:8px; }
.c-cost{ font-size:12px; color:var(--text-muted); margin-top:8px; }
.c-cost b{ color:var(--accent); }
body.wide .tabbar{ max-width:1240px; }
.c-preview video, .c-preview img{ width:100%; border-radius:12px; display:block; background:#000; }
.c-preview a{ display:block; font-size:12px; margin-top:6px; color:var(--accent); }
.c-stage{ font-size:12px; color:var(--text-muted); margin-top:4px; }
@media (max-width:420px){ .money-bar b{ font-size:15px; } .money-bar > div{ padding:8px 9px; } }
.spinner{ width:28px; height:28px; margin:0 auto 8px; border-radius:50%; border:3px solid var(--border); border-top-color:var(--accent); animation:insafea-spin .9s linear infinite; }
@keyframes insafea-spin{ to{ transform:rotate(360deg); } }
.multi-cell.over{ outline:2px solid #e5484d; opacity:.55; }
.people .row button + button{ margin-left:4px; }
.console-right .c-log{ max-height:300px; overflow:auto; }
@media (min-width:960px){ .console-right{ max-height:calc(100vh - 160px); overflow:auto; } .console-right .c-log{ max-height:220px; } }
