:root{
  --bg:#f6f7fb; --card:#fff; --text:#111827; --muted:#6b7280;
  --border:#e5e7eb; --primary:#2563eb; --primary2:#1d4ed8; --danger:#dc2626;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius:16px;
}

*{box-sizing:border-box}

body{
  margin:0;
  padding:32px 16px;
  font-family: ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",Arial;
  background:var(--bg);
  color:var(--text);
}

.wrap{max-width:1040px;margin:0 auto}

header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}

h1{font-size:22px;margin:0}

.sub{color:var(--muted);font-size:13px;margin-top:6px}

.grid{display:grid;grid-template-columns: 380px 1fr; gap:18px}

@media (max-width: 920px){
  .grid{grid-template-columns:1fr}
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.card h2{
  margin:0;
  font-size:14px;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  color:#111827;
  background:linear-gradient(#fff,#fbfbfd);
}

.content{padding:16px}

label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin:12px 0 6px
}

input[type="text"], input[type="file"]{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  font-size:14px;
  outline:none;
  background:#fff;
}

input[type="text"]:focus{
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(147,197,253,.35)
}

.row{display:grid;grid-template-columns:1fr 1fr; gap:12px}

@media (max-width: 520px){
  .row{grid-template-columns:1fr}
}

.btns{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}

button{
  border:0;
  border-radius:12px;
  padding:10px 14px;
  font-size:14px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
}

#genIcon{
  display:inline-flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
}

.primary{background:var(--primary); color:#fff}
.primary:hover{background:var(--primary2)}
.ghost{background:#f3f4f6; color:#111827}
.ghost:hover{background:#e5e7eb}
.danger{background:#fee2e2;color:#991b1b}
.danger:hover{background:#fecaca}
button:disabled{opacity:.6;cursor:not-allowed}
.hint{font-size:12px;color:var(--muted);margin-top:10px;line-height:1.4}
.status{margin-top:12px;font-size:13px}
.status.ok{color:#065f46}
.status.err{color:var(--danger)}
.pill{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;border:1px solid var(--border);background:#fff;font-size:12px;color:var(--muted)}
.sep{height:1px;background:var(--border);margin:14px 0}

.preview{display:grid;grid-template-columns:220px 1fr;gap:14px;align-items:start}

@media (max-width: 720px){
  .preview{grid-template-columns:1fr}
}

.thumb{
  border:1px dashed var(--border);
  border-radius:14px;
  background:#fafafa;
  min-height:220px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.thumb img{max-width:100%;height:auto;display:block}
.out a{color:var(--primary); text-decoration:none}
.out a:hover{text-decoration:underline}

.imgwrap{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
}

.imgwrap img{width:100%;display:block}
.small{font-size:12px;color:var(--muted)}
.kbd{font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; font-size:12px; padding:2px 6px; border:1px solid var(--border); border-radius:8px; background:#fff}

.spin{
  display:inline-block;
  flex:0 0 auto;
  width:14px;
  height:14px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.45);
  border-top-color:#fff;
  animation:spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
