:root{
  --bg-primary: #0a0a0a;
  --bg-secondary: #141415;
  --bg-card: rgba(20, 20, 25, 0.95);
  --bg-input: rgba(10, 10, 12, 0.9);
  --accent-neon: #00f5ff;
  --accent-purple: #9d4edd;
  --accent-blue: #0077ff;
  --accent-pink: #ff0054;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.88);
  --text-muted: rgba(255, 255, 255, 0.4);
  --border-primary: rgba(0, 245, 255, 0.2);
  --border-hover: rgba(0, 245, 255, 0.6);
  --shadow-neon: 0 0 30px rgba(0, 245, 255, 0.2);
  --shadow-card: 0 12px 40px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --wechat-yellow: #FFE072;
  --ok: #52c41a;
  --warn: #faad14;
  --err: #ff4d4f;
  --info: #1890ff;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; color:var(--text-primary);
  background: var(--bg-primary);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
header{
  padding: 32px 24px;
  background: linear-gradient(180deg, rgba(20,20,25,0.8), rgba(15,15,18,0.9));
  border-bottom: 1px solid var(--border-primary);
  backdrop-filter: blur(20px);
}
h1{
  margin: 0 0 20px 0;
  font-size: 36px;
  font-weight: 900;
  color: var(--wechat-yellow);
  letter-spacing: -0.5px;
  text-shadow: 0 0 20px rgba(255, 224, 114, 0.4);
}
.author-bar{
  display: flex; align-items: center; gap: 12px;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
}
.author-item{ display: flex; align-items: center; gap: 8px; }
.highlight{
  color: var(--accent-neon);
  font-weight: 800;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.3);
}
.badge{
  padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
  font-weight: 700; font-size: 12px;
  box-shadow: 0 2px 8px rgba(157, 78, 221, 0.3);
}
.notice{
  margin: 24px 0; padding: 18px 20px; border-radius: var(--radius);
  background: rgba(255, 171, 0, 0.08);
  border: 1px solid rgba(255, 171, 0, 0.25);
  color: var(--warn);
  display: flex; align-items: center; gap: 12px;
  font-weight: 600; font-size: 13px;
  backdrop-filter: blur(10px);
}
.expired-notice{
  background: rgba(255, 82, 82, 0.08);
  border-color: rgba(255, 82, 82, 0.25);
  color: var(--err);
}
.notice-icon{ font-size: 20px; }
main{ max-width: 1240px; margin: 0 auto; padding: 32px 24px 80px }

/* 输入区域 */
.prompt-container{
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.prompt-container:hover{ border-color: var(--border-hover); }
.prompt-header{
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-primary);
}
.prompt-title{
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px;
  color: var(--text-secondary);
}
.prompt-icon{
  width: 24px; height: 24px;
  fill: var(--accent-neon);
  filter: drop-shadow(0 0 6px var(--accent-neon));
}
.char-count{ color: var(--text-muted); font-size: 12px }
.prompt-input{
  width: 100%; min-height: 180px; max-height: 400px;
  border: none; outline: none; resize: vertical;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px; line-height: 1.7;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: var(--transition);
}
.prompt-input:focus{ box-shadow: inset 0 0 0 1px var(--accent-neon); }

/* 图片上传 */
.upload-area{
  margin-top: 16px; padding: 16px;
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-sm);
  background: rgba(0, 245, 255, 0.05);
  transition: var(--transition);
}
.upload-area:hover, .upload-area.dragover{
  border-color: var(--border-hover);
  background: rgba(0, 245, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.15);
}
.upload-box{
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer; border-radius: var(--radius-sm);
}
.upload-icon{
  width: 32px; height: 32px;
  fill: var(--accent-neon);
  filter: drop-shadow(0 0 6px var(--accent-neon));
}
.upload-text{ font-weight: 600; font-size: 14px; }
.upload-limit{ margin-left: auto; color: var(--text-muted); font-size: 12px }
.thumbs{ display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px }
.thumb{
  position: relative; border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-secondary);
  aspect-ratio: 1; transition: var(--transition);
}
.thumb:hover{
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(157, 78, 221, 0.3);
}
.thumb img{ width: 100%; height: 100%; object-fit: cover }
.thumb .x{
  position: absolute; top: 6px; right: 6px;
  background: var(--accent-pink); color: #fff;
  border: none; border-radius: 999px;
  cursor: pointer; font-size: 11px; padding: 4px 8px;
  font-weight: 700; transition: var(--transition);
  box-shadow: 0 2px 8px rgba(255, 0, 84, 0.4);
}
.thumb .x:hover{ transform: scale(1.1); }

/* Key管理 */
.key-section{
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.key-header{
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.key-title{
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px;
}
.key-icon{ width: 20px; height: 20px; fill: var(--accent-purple); }
.key-input-group{
  display: flex; gap: 12px; flex-wrap: wrap;
}
.key-input{
  flex: 1; min-width: 320px; height: 48px;
  padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-primary); outline: none;
  transition: var(--transition);
}
.key-input:focus{ border-color: var(--accent-neon); box-shadow: 0 0 12px rgba(0, 245, 255, 0.2); }
.usage-result{ margin-top: 16px; }
.usage-info{
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(0, 119, 255, 0.1);
  border: 1px solid var(--border-primary);
  color: var(--info);
  font-size: 13px; line-height: 1.8;
  font-family: 'Fira Code', 'Consolas', monospace;
  white-space: pre-line;
}
.usage-info.error{
  background: rgba(255, 82, 82, 0.1);
  border-color: rgba(255, 82, 82, 0.3);
  color: var(--err);
}

/* 控制栏 & 尺寸选择 */
.control-bar{
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; margin-bottom: 32px;
  flex-wrap: wrap;
}
.generate-config{
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.config-group{
  display: flex; flex-direction: column; gap: 8px;
}
.config-label{
  font-weight: 600; font-size: 13px;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}
.config-icon{
  width: 16px; height: 16px;
  fill: var(--accent-neon);
}
.num-select, .aspect-select{
  height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-primary); outline: none;
  transition: var(--transition);
  font-size: 14px;
}
.num-select:focus, .aspect-select:focus{ border-color: var(--accent-neon); }

/* 尺寸按钮组 */
.aspect-buttons{
  display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px; max-width: 400px;
}
.aspect-btn{
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-muted);
  border: 1px solid var(--border-primary);
  cursor: pointer; transition: var(--transition);
  font-size: 12px; font-weight: 600;
  text-align: center;
}
.aspect-btn:hover{
  border-color: var(--accent-neon);
  color: var(--accent-neon);
}
.aspect-btn.active{
  background: rgba(0, 245, 255, 0.15);
  border-color: var(--accent-neon);
  color: var(--accent-neon);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}

.status{ display: flex; align-items: center; gap: 12px }
.pill{
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border-primary); padding: 8px 16px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.spin{
  width: 22px; height: 22px;
  border: 2px solid rgba(0, 245, 255, 0.2);
  border-top-color: var(--accent-neon);
  border-radius: 50%; animation: rot 1s linear infinite; display: none;
}
.spin.show{ display: inline-block }

/* 结果区域 */
.split{
  display: grid; grid-template-columns: 2fr 1fr; gap: 24px;
  margin-top: 32px; align-items: start;
}
@media (max-width: 900px){ .split{ grid-template-columns: 1fr } }
.gallery{ display: grid; grid-template-columns: 1fr; gap: 20px }
.run-card{
  background: var(--bg-card); border: 1px solid var(--border-primary);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-card); transition: var(--transition);
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.run-card:hover{ border-color: var(--border-hover); }
.run-head{
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border-primary);
}
.run-title{
  font-weight: 700; font-size: 14px;
  color: var(--accent-neon);
  font-family: 'Fira Code', monospace;
}
.run-thumbs{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px
}
.shot{
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-secondary);
  cursor: pointer; transition: var(--transition);
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.shot:hover{
  transform: translateY(-4px);
  box-shadow: var(--shadow-neon);
  border-color: var(--accent-neon);
}
.shot img{ width: 100%; height: auto; display: block }
.shot .bar{
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-primary);
}

/* 日志区域 */
.log-card{
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.log-card.show {
  opacity: 1;
  pointer-events: auto;
}

.log-title{
  font-weight: 800; margin: 0 0 12px 0;
  color: var(--accent-purple); font-size: 14px;
}
.log-list{
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm); overflow: auto; max-height: 520px;
}
.log-item{
  display: grid; grid-template-columns: 1.4em 1fr; gap: 10px;
  padding: 10px; align-items: start;
  border-top: 1px solid rgba(0, 245, 255, 0.1);
  font-size: 13px; line-height: 1.6;
}
.log-item:first-child{ border-top: none }
.log-ico{ font-weight: 900; font-size: 18px; text-align: center; margin-top: 1px }
.ico-ok{ color: var(--ok) }
.ico-err{ color: var(--err) }
.ico-warn{ color: var(--warn) }
.ico-info{ color: var(--info) }
.log-text{ white-space: pre-wrap; word-break: break-word; color: var(--text-secondary) }

/* 光箱 */
.lightbox{
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(20px);
}
.lightbox.show{ display: flex }
.lb-inner{
  position: relative; max-width: 92vw; max-height: 88vh;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-neon);
}
.lb-main{ flex: 1; display: flex; align-items: center; justify-content: center }
.lb-main img{ max-width: 100%; max-height: 100%; border-radius: var(--radius-sm) }
.lb-bar{
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 6px; border-top: 1px solid var(--border-primary);
}
.lb-caption{
  color: var(--text-muted); font-size: 12px;
  font-family: 'Fira Code', monospace;
}
.navbtn, .closebtn{
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px;
  cursor: pointer; font-weight: 600; font-size: 13px;
  transition: var(--transition); border: 1px solid var(--border-primary);
}
.navbtn{
  background: rgba(0, 245, 255, 0.1); color: var(--accent-neon);
}
.navbtn:hover{ background: rgba(0, 245, 255, 0.2); }
.closebtn{
  background: rgba(255, 255, 255, 0.05); color: var(--text-secondary);
}
.closebtn:hover{ background: rgba(255, 255, 255, 0.1); }
.lb-close-btn{
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: rgba(255, 0, 84, 0.9);
  border: 1px solid var(--accent-pink);
  border-radius: 999px;
  color: #fff;
  font-size: 18px; font-weight: 800;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  z-index: 10;
  box-shadow: 0 2px 12px rgba(255, 0, 84, 0.4);
}
.lb-close-btn:hover{ transform: scale(1.1); background: var(--accent-pink); }

/* 按钮样式 */
.btn{
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: var(--transition); border: none;
}
.btn.primary{
  background: linear-gradient(135deg, var(--accent-neon), var(--accent-blue));
  color: #000;
}
.btn.primary:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-neon);
}
.btn.danger{
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  color: #fff;
}
.btn.danger:hover{ transform: translateY(-2px); }
.btn[disabled]{ opacity: 0.5; cursor: not-allowed; transform: none !important }

/* 按钮 */
.load-more {
  text-align: center;
  padding: 20px;
  margin-top: 20px;
}
.load-more button {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.load-more button:hover {
  border-color: var(--accent-neon);
  color: var(--accent-neon);
}

footer{
  margin-top: 60px; padding: 20px;
  text-align: center; color: var(--text-muted);
  border-top: 1px solid var(--border-primary);
}

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

/* 流式加载动画 */
@keyframes stream {
  0% { left: -100%; }
  100% { left: 100%; }
}

.streaming {
  position: relative;
  overflow: hidden;
}

.streaming::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 245, 255, 0.1), transparent);
  animation: stream 1.5s linear infinite;
}

/* 模型选择下拉框样式 */
.model-select {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  outline: none;
  transition: var(--transition);
  font-size: 14px;
  min-width: 140px;
}

.model-select:focus {
  border-color: var(--accent-neon);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.2);
}