/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  margin: 0;
  padding: 1rem;
  background: #0e0e10;
  color: #efeff1;
  min-height: 100vh;
}
.container { max-width: 720px; margin: 0 auto; }
h1 { margin: 1.5rem 0 0.4rem; font-size: 28px; }
.subtitle { color: #8b8b8b; margin: 0 0 1.5rem; }

/* ---------- 全屏加载圈 ---------- */
.spinner-overlay {
  position: fixed; inset: 0;
  background: rgba(14, 14, 16, 0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}
.spinner-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner-ring {
  width: 84px; height: 84px;
  border: 7px solid #2a2a2e;
  border-top-color: #5b9bff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.spinner-text {
  margin-top: 1.2rem;
  color: #b8b8b8;
  font-size: 14px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  max-width: 80%;
  text-align: center;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 状态面板 ---------- */
.status-panel {
  background: #18181b;
  border: 1px solid #2a2a2e;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  text-align: left;
}
.process-panel { margin-top: 1.5rem; }
.status-step {
  display: flex; align-items: flex-start;
  gap: 0.6rem;
  padding: 0.25rem 0;
  font-size: 13.5px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  color: #6b6b75;
  transition: color 0.2s;
}
.status-step .dot {
  flex: 0 0 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}
.status-step.pending { color: #6b6b75; }
.status-step.active  { color: #5b9bff; }
.status-step.active .dot { animation: pulse 1.2s ease-in-out infinite; }
.status-step.done    { color: #4ade80; }
.status-step.error   { color: #f87171; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- 上传 + 提交 ---------- */
.upload-area {
  display: flex; flex-direction: column;
  align-items: center; gap: 0.8rem;
  margin: 1rem 0;
}
input[type="file"] {
  display: block;
  width: 100%;
  padding: 1rem;
  background: #1f1f23;
  border: 2px dashed #3a3a3f;
  border-radius: 10px;
  color: #d4d4d4;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
input[type="file"]:not(:disabled):hover {
  border-color: #5b9bff;
  background: #252529;
}
input[type="file"]:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  display: inline-block;
  min-width: 200px;
  padding: 0.85rem 2rem;
  background: linear-gradient(180deg, #5b9bff, #3b7dd8);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 2px 8px rgba(91, 155, 255, 0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 155, 255, 0.4);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled {
  background: #2a2a2e;
  color: #6b6b75;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- 调参 ---------- */
.controls {
  display: flex; flex-direction: column;
  gap: 0.8rem;
  margin: 1.2rem 0;
  padding: 1rem;
  background: #18181b;
  border: 1px solid #2a2a2e;
  border-radius: 10px;
}
.control-row { display: flex; flex-direction: column; gap: 0.3rem; }
.control-row label { font-size: 13px; color: #b8b8b8; }
.control-row span { color: #5b9bff; font-weight: 600; }
input[type="range"] {
  width: 100%;
  accent-color: #5b9bff;
}

/* ---------- 预览 ---------- */
#preview {
  max-width: 320px;
  max-height: 360px;
  margin: 1rem auto;
  border-radius: 10px;
  display: none;
  border: 2px solid #2a2a2e;
}

/* ---------- 结果 ---------- */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
  margin-top: 1.5rem;
}
.result-card {
  border-radius: 10px;
  overflow: hidden;
  background: #18181b;
  border: 1px solid #2a2a2e;
  transition: transform 0.2s, border-color 0.2s;
}
.result-card:hover { transform: translateY(-2px); border-color: #5b9bff; }
.result-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.result-card .label {
  padding: 6px 10px;
  font-size: 12px;
  color: #b8b8b8;
  display: flex; justify-content: space-between;
}
.result-card .similarity { color: #4ade80; font-weight: 600; }
