* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f0f2f5;
  color: #222;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #1a7a4a, #27ae60);
  color: #fff;
  padding: 18px 32px;
  display: flex;
  align-items: baseline;
  gap: 20px;
}
header .logo { font-size: 22px; font-weight: 800; }
header .logo span { font-size: 13px; font-weight: 400; opacity: .85; margin-left: 6px; }
header h1 { font-size: 17px; font-weight: 500; opacity: .95; }

main {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  padding: 20px 32px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; padding: 12px; } }

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.panel h2 { font-size: 15px; margin: 18px 0 10px; }
.panel h2:first-child { margin-top: 0; }
.panel h2 small { font-weight: 400; color: #999; }

/* 上传区 */
.drop-zone {
  border: 2px dashed #bbb;
  border-radius: 10px;
  padding: 26px;
  text-align: center;
  color: #888;
  cursor: pointer;
  transition: .2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: #27ae60; color: #27ae60; background: #f2fbf5; }

.preview-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview-item { position: relative; width: 72px; height: 72px; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.preview-item .remove {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #e74c3c; color: #fff; border: none;
  font-size: 12px; line-height: 20px; cursor: pointer;
}

/* 提示词 */
textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
textarea:focus { outline: none; border-color: #27ae60; }

.template-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-template {
  border: 1px solid #27ae60;
  background: #fff;
  color: #27ae60;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.btn-template:hover { background: #f2fbf5; }

/* 设置 */
.settings-row { display: flex; gap: 16px; flex-wrap: wrap; }
.settings-row label { font-size: 13px; color: #555; display: flex; flex-direction: column; gap: 4px; }
.settings-row select {
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.btn-generate {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #1a7a4a, #27ae60);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: .2s;
}
.btn-generate:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(39,174,96,.35); }
.btn-generate:disabled { opacity: .55; cursor: not-allowed; }

.status-text { margin-top: 6px; font-size: 13px; color: #e67e22; min-height: 18px; text-align: center; }
.status-text.error { color: #e74c3c; }
.usage-text { margin-top: 8px; font-size: 12px; color: #999; text-align: center; }

/* 结果区 */
.result-list { display: flex; flex-wrap: wrap; gap: 14px; min-height: 80px; }
.result-card { width: 200px; }
.result-card img {
  width: 100%;
  border-radius: 10px;
  cursor: zoom-in;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.result-card .actions { display: flex; gap: 6px; margin-top: 6px; }
.result-card .actions a, .result-card .actions button {
  flex: 1;
  text-align: center;
  font-size: 12px;
  padding: 5px 0;
  border-radius: 6px;
  border: 1px solid #27ae60;
  color: #27ae60;
  text-decoration: none;
  background: #fff;
  cursor: pointer;
}
.result-card .actions a:hover { background: #f2fbf5; }
.result-list.history .result-card { width: 130px; }
.empty-tip { color: #aaa; font-size: 14px; padding: 30px 0; width: 100%; text-align: center; }

/* 生成中动画 */
.loading-card {
  width: 200px; height: 266px;
  border-radius: 10px;
  background: linear-gradient(100deg, #eee 40%, #f7f7f7 50%, #eee 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  display: flex; align-items: center; justify-content: center;
  color: #999; font-size: 13px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* 弹窗 */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-box {
  background: #fff; border-radius: 12px;
  padding: 28px 32px; width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-box h2 { font-size: 17px; }
.modal-box input {
  padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px;
}
.modal-box button {
  padding: 10px; border: none; border-radius: 8px;
  background: #27ae60; color: #fff; font-size: 15px; cursor: pointer;
}
.hidden { display: none !important; }
.error-text { color: #e74c3c; font-size: 13px; }

/* 大图预览 */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
