/* EO 图像实验室 · 样式
   视觉规范对齐 EdgeOne 体系：腾讯云蓝 #006EFF + 浅色卡片 + 8px 圆角体系 */

:root {
  /* 品牌主色：腾讯云蓝 */
  --color-primary: #006EFF;
  --color-primary-dark: #0052CC;
  --color-primary-light: #4D94FF;
  --color-primary-50: #EBF4FF;

  --color-bg: #FFFFFF;
  --color-bg-secondary: #F5F7FA;
  --color-bg-tertiary: #FAFBFC;
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-border: #E2E8F0;

  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.06);

  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

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

html, body { min-height: 100%; }

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0, 110, 255, 0.08) 0%, transparent 70%),
    linear-gradient(180deg, #F8FAFF 0%, #FFFFFF 100%);
  background-attachment: fixed;
  color: var(--color-text);
  line-height: 1.7;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, select { transition: all 0.2s var(--ease-out); }
button:active { transform: scale(0.98); }

/* ===== 背景光斑（浅色体系下压到很淡）===== */
.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(90px);
  background: rgba(0, 110, 255, 0.10);
  animation: float 18s ease-in-out infinite;
}
.bg-orbs span:nth-child(1) { width: 460px; height: 460px; top: -140px; left: -80px; }
.bg-orbs span:nth-child(2) { width: 380px; height: 380px; bottom: -160px; right: -60px; animation-delay: -6s; background: rgba(0, 163, 255, 0.10); }
.bg-orbs span:nth-child(3) { width: 320px; height: 320px; top: 42%; left: 55%; animation-delay: -12s; opacity: .7; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, -30px, 0) scale(1.08); }
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: 14px var(--space-6);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius-lg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: .5px; color: #fff;
  background: linear-gradient(135deg, var(--color-primary) 0%, #00A3FF 100%);
  box-shadow: 0 2px 8px rgba(0, 110, 255, 0.25);
}
.brand-text h1 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.4; }
.brand-text p { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.quota-badge {
  padding: 5px 12px; border-radius: var(--radius-full);
  font-size: 12.5px; color: var(--color-primary);
  background: var(--color-primary-50);
  border: 1px solid rgba(0, 110, 255, 0.16);
}

/* ===== 布局 ===== */
.layout {
  position: relative; z-index: 1;
  max-width: 1140px; margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-10);
  display: grid; grid-template-columns: minmax(360px, 420px) 1fr;
  gap: var(--space-6);
  align-items: start;
}

.panel, .results {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
}

/* ===== 模式切换 ===== */
.tabs {
  display: flex; gap: 2px; padding: 5px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}
.tab {
  flex: 1; padding: 10px 14px; border: none; background: transparent;
  border-radius: var(--radius-md); font-family: inherit;
  font-size: 14px; font-weight: 500; color: var(--color-text-secondary);
  cursor: pointer; white-space: nowrap;
}
.tab:hover:not(:disabled) { color: var(--color-text); }
.tab.is-active {
  background: var(--color-bg);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 表单 ===== */
.field { display: block; margin-bottom: var(--space-4); position: relative; }
.field-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--color-text); margin-bottom: var(--space-2);
}
.field-label .hint, .hint { font-weight: 400; font-size: 12px; color: var(--color-text-muted); margin-left: 6px; }

textarea, select, .gate-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-family: inherit; font-size: 14px; line-height: 1.7;
  color: var(--color-text); background: var(--color-bg-tertiary);
  outline: none; transition: all 0.2s var(--ease-out);
}
textarea { resize: vertical; min-height: 110px; }
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2394A3B8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea:focus, select:focus, .gate-input:focus {
  border-color: var(--color-primary);
  background: var(--color-bg);
  box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.1);
}
textarea::placeholder, .gate-input::placeholder { color: var(--color-text-muted); }
textarea::-webkit-scrollbar { width: 6px; }
textarea::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 20px; }

.counter {
  position: absolute; right: 10px; bottom: 8px;
  font-size: 11.5px; color: var(--color-text-muted);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field-inline { margin-bottom: var(--space-4); }

/* ===== 提示词胶囊 ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-5); }
.chip {
  padding: 6px 12px; border-radius: var(--radius-full); cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-bg);
  font-family: inherit; font-size: 12.5px; color: var(--color-text-secondary);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip.is-active {
  background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 600;
}

/* ===== 上传区 ===== */
.edit-panel { margin-bottom: var(--space-4); }
.dropzone {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-lg); padding: 24px 18px; text-align: center; cursor: pointer;
  background: var(--color-bg-tertiary); outline: none;
  transition: all 0.2s var(--ease-out);
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-drag {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
}
.dropzone-inner p { margin: 8px 0 0; font-size: 13.5px; color: var(--color-text-secondary); }
.dropzone-inner p b { color: var(--color-primary); }
.dropzone-sub { font-size: 12px !important; color: var(--color-text-muted) !important; }
.upload-icon {
  width: 28px; height: 28px; fill: none; stroke: var(--color-primary);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.thumb-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb {
  position: relative; width: 84px; height: 84px;
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--color-border); background: var(--color-bg-secondary);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-error { border-color: var(--color-error); }
.thumb-badge {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 10.5px; text-align: center; padding: 3px 0;
  background: rgba(15, 23, 42, 0.62); color: #fff;
}
.thumb-del {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(15, 23, 42, 0.55); color: #fff; font-size: 11px; line-height: 1;
  display: grid; place-items: center;
}
.thumb-del:hover { background: var(--color-error); }

/* ===== 按钮 ===== */
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; padding: 12px 18px; border: none; cursor: pointer;
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 14px; font-weight: 600; color: #fff;
  background: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 110, 255, 0.25);
}
.primary-btn:hover:not(:disabled) { background: var(--color-primary-dark); box-shadow: 0 4px 12px rgba(0, 110, 255, 0.32); }
.primary-btn:active:not(:disabled) { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.submit-btn { margin-top: var(--space-2); }

.ghost-btn {
  padding: 7px 14px; border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-bg);
  font-family: inherit; font-size: 13px; color: var(--color-text-secondary);
}
.ghost-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.ghost-btn.sm { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-sm); text-decoration: none; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-error { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: var(--color-error); }

/* ===== 状态条 ===== */
.status-card {
  border: 1px solid var(--color-border); background: var(--color-bg-secondary);
  border-radius: var(--radius-lg); padding: 12px 14px; margin-bottom: var(--space-5);
}
.status-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-secondary); }
.status-timer { margin-left: auto; font-size: 12px; color: var(--color-text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-muted); }
.status-dot.is-running { background: var(--color-warning); animation: pulse 1.1s ease-in-out infinite; }
.status-dot.is-succeeded { background: var(--color-success); }
.status-dot.is-failed { background: var(--color-error); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.progress { margin-top: 10px; height: 4px; border-radius: var(--radius-full); background: var(--color-border); overflow: hidden; }
.progress-bar {
  height: 100%; width: 45%; border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-primary), #00A3FF);
  transition: width .6s var(--ease-out);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center; padding: 56px 20px;
  border: 1px dashed var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary); color: var(--color-text-secondary);
}
.empty-art { font-size: 38px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }
.empty-sub { font-size: 12.5px !important; color: var(--color-text-muted) !important; }

/* ===== 结果画廊 ===== */
.gallery {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-bottom: var(--space-6);
}
.result-card {
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--color-border); background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  animation: pop .3s var(--ease-out) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.result-card img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; cursor: zoom-in;
  transition: transform .35s var(--ease-out);
}
.result-card:hover img { transform: scale(1.03); }
.result-actions { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--color-border); }
.action-btn {
  flex: 1; padding: 7px 0; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-bg);
  font-family: inherit; font-size: 12px; color: var(--color-text-secondary);
}
.action-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-50); }

/* ===== 超分对比 ===== */
.compare-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-bg); padding: var(--space-4);
  margin-bottom: var(--space-6); box-shadow: var(--shadow-sm);
}
.compare-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.compare-head .field-label { margin: 0; }
.compare-meta { font-size: 12px; color: var(--color-text-muted); }
.compare-head .ghost-btn { margin-left: auto; }
.compare-wrap {
  position: relative; --split: 50%;
  border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg-secondary);
}
.compare-img { width: 100%; display: block; }
.compare-before {
  position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}
.compare-before .compare-img { height: 100%; object-fit: cover; }
.compare-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: var(--split);
  width: 2px; transform: translateX(-1px); background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15); pointer-events: none;
}
.compare-tag {
  position: absolute; top: 10px; padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11.5px; color: #fff; background: rgba(15, 23, 42, 0.55);
}
.tag-left { left: 10px; }
.tag-right { right: 10px; }
.compare-range { width: 100%; margin-top: 10px; accent-color: var(--color-primary); }

.zoom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.zoom-cell { min-width: 0; }
.zoom-box {
  height: 150px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background-color: var(--color-bg-secondary);
  background-repeat: no-repeat; background-position: center;
}
.zoom-label { font-size: 12px; color: var(--color-text-muted); margin-top: 6px; text-align: center; }
.zoom-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.zoom-ctrl .field-label { margin: 0; }

/* ===== 历史 ===== */
.history { border-top: 1px solid var(--color-border); padding-top: var(--space-4); }
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.history-head .field-label { margin: 0; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; align-items: center; gap: 11px; padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--color-bg-secondary); border: 1px solid var(--color-border);
}
.history-item img { width: 44px; height: 44px; border-radius: var(--radius-md); object-fit: cover; cursor: zoom-in; flex: none; }
.history-meta { min-width: 0; flex: 1; }
.history-prompt {
  font-size: 13px; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-sub { font-size: 11.5px; color: var(--color-text-muted); }
.history-empty { margin-top: 8px; font-size: 12.5px; color: var(--color-text-muted); text-align: center; }

/* ===== 大图查看 ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.9);
  display: grid; place-items: center; padding: 40px;
  animation: fade .2s var(--ease-out) both;
}
@keyframes fade { from { opacity: 0; } }
.lightbox img { max-width: min(92vw, 900px); max-height: 84vh; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); border: none; color: var(--color-text); font-size: 15px;
}
.lightbox-btn {
  position: absolute; bottom: 26px;
  padding: 10px 22px; border-radius: var(--radius-md); text-decoration: none; font-size: 13.5px;
  color: #fff; background: var(--color-primary); box-shadow: 0 2px 8px rgba(0, 110, 255, 0.3);
}

/* ===== 邀请码闸门 ===== */
/* 未通过校验前锁住页面内容：闸门是覆盖层，不锁的话 DOM 里的界面仍可被看到/操作 */
body.is-locked .topbar,
body.is-locked .layout { display: none; }

.gate {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 24px;
  background: rgba(248, 250, 255, 0.94); backdrop-filter: blur(6px);
}
.gate-card {
  width: 100%; max-width: 380px; text-align: center;
  padding: 32px 28px; border-radius: var(--radius-2xl);
  background: var(--color-bg); border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}
.gate-mark {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: var(--radius-lg);
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--color-primary) 0%, #00A3FF 100%);
  box-shadow: 0 2px 8px rgba(0, 110, 255, 0.25);
}
.gate-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.gate-sub { margin-bottom: 20px; font-size: 13px; color: var(--color-text-secondary); }
.gate-input { margin-bottom: 10px; text-align: center; letter-spacing: 2px; }
.gate-error { min-height: 18px; margin-bottom: 12px; font-size: 12.5px; color: var(--color-error); }

/* ===== Toast ===== */
.toast-wrap {
  position: fixed; z-index: 70; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 10px 18px; border-radius: var(--radius-md); font-size: 13px; color: #fff;
  background: var(--color-text); box-shadow: var(--shadow-lg);
  animation: toastIn .22s var(--ease-out) both;
}
.toast.is-out { animation: toastOut .3s var(--ease-out) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

.hidden { display: none !important; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: var(--space-6) var(--space-4) var(--space-8); }
  .panel, .results { padding: var(--space-4); border-radius: var(--radius-xl); }
  .topbar { padding: 12px var(--space-4); }
}
@media (max-width: 560px) {
  .brand-text p { display: none; }
  .row { grid-template-columns: 1fr; }
  .zoom-row { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
