/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F0F2F5;
  --card:        #FFFFFF;
  --border:      #E5E7EB;
  --border-focus:#A5B4FC;
  --accent:      #4F46E5;
  --accent-h:    #4338CA;
  --accent-lite: #EEF2FF;
  --success:     #10B981;
  --warning:     #F59E0B;
  --error:       #EF4444;
  --text:        #111827;
  --text-m:      #6B7280;
  --text-sm:     #9CA3AF;
  --shadow:      0 1px 3px rgb(0 0 0/.10), 0 1px 2px -1px rgb(0 0 0/.06);
  --shadow-lg:   0 10px 20px -4px rgb(0 0 0/.12);
  --radius:      12px;
  --radius-sm:   8px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

body { background: var(--bg); min-height: 100vh; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 32px;
  width: 100%; max-width: 460px;
}
.modal-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.modal-header svg { color: var(--accent); }
.modal-desc {
  font-size: 12px; color: var(--text-m);
  background: var(--accent-lite);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 20px;
  line-height: 1.6;
}
.modal-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px 4px;
  margin-bottom: 16px;
  background: #FAFAFB;
}
.modal-group-title {
  font-size: 12px; font-weight: 700; color: var(--accent);
  margin-bottom: 12px;
}
.modal-field { margin-bottom: 14px; }
.modal-field label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-m); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .5px;
}
.required { color: var(--error); }
.optional { color: var(--text-sm); font-weight: 400; text-transform: none; letter-spacing: 0; }
.key-input-wrap {
  position: relative; display: flex; align-items: center;
}
.key-input-wrap input {
  width: 100%; padding: 9px 40px 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: monospace; color: var(--text);
  outline: none; background: #FAFAFA;
  transition: border-color .15s, box-shadow .15s;
}
.key-input-wrap input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px #EEF2FF;
  background: var(--card);
}
.btn-eye {
  position: absolute; right: 10px;
  background: none; border: none;
  color: var(--text-sm); cursor: pointer;
  display: flex; align-items: center;
  padding: 4px;
  transition: color .15s;
}
.btn-eye:hover { color: var(--accent); }
.key-hint {
  display: block; font-size: 11px; color: var(--text-sm);
  margin-top: 5px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn { flex: 1; }

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgb(0 0 0/.05);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: var(--text);
  letter-spacing: -.3px;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.key-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-m);
}
.key-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.key-dot--off  { background: #D1D5DB; }
.key-dot--on   { background: var(--success); box-shadow: 0 0 0 2px #D1FAE5; }
.header-badge {
  font-size: 11px; font-weight: 500;
  color: var(--accent); background: var(--accent-lite);
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid #C7D2FE;
}

/* ── Workspace ── */
.workspace {
  max-width: 1400px; margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  min-height: calc(100vh - 56px);
}

.panel { display: flex; flex-direction: column; gap: 16px; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px; color: var(--text);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header svg { color: var(--accent); flex-shrink: 0; }
.card-hint {
  margin-left: auto;
  font-size: 11px; font-weight: 400; color: var(--text-sm);
}

/* ── Upload Zone ── */
.upload-zone {
  cursor: pointer; padding: 0; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  border: 2px dashed var(--border);
}
.upload-zone.drag-over {
  border-color: var(--accent); box-shadow: 0 0 0 4px #EEF2FF;
}
.upload-placeholder {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 40px 20px; text-align: center;
}
.upload-title { font-size: 15px; font-weight: 600; }
.upload-sub   { color: var(--text-m); font-size: 13px; }
.upload-hint  { color: var(--text-sm); font-size: 12px; }
.link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.upload-preview { position: relative; }
.upload-preview img {
  width: 100%; display: block; border-radius: 10px;
  max-height: 320px; object-fit: contain; background: #F9FAFB;
}
.reupload-btn {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.45); color: #fff;
  border: none; border-radius: 6px; padding: 6px;
  cursor: pointer; display: flex; align-items: center;
  transition: background .15s;
}
.reupload-btn:hover { background: rgba(0,0,0,.65); }
.upload-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 48px 20px; color: var(--text-m);
}

/* ── Product Fields ── */
.fields { display: flex; flex-direction: column; gap: 10px; }
.field-row { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-sm);
}
.field-value {
  padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text);
  background: #FAFAFA; transition: border-color .15s, background .15s;
  cursor: text; min-height: 34px; outline: none; line-height: 1.4;
}
.field-value:focus {
  border-color: var(--border-focus); background: var(--card);
  box-shadow: 0 0 0 3px #EEF2FF;
}
.styles-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.styles-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-sm); margin-bottom: 8px;
}
.styles-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.style-tag {
  padding: 5px 12px; border: 1px solid #C7D2FE;
  border-radius: 20px; background: var(--accent-lite);
  color: var(--accent); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.style-tag:hover { background: #E0E7FF; transform: translateY(-1px); }
.style-tag.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Action Card ── */
.skill-controls {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FAFAFB;
  padding: 10px;
  margin-bottom: 12px;
}
.skill-control-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.skill-control-head span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.skill-control-head small {
  font-size: 11px;
  color: var(--text-sm);
}
.skill-control-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.skill-toggle {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-m);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.skill-toggle:hover {
  border-color: var(--border-focus);
  color: var(--accent);
}
.skill-toggle.active {
  background: var(--accent-lite);
  border-color: #C7D2FE;
  color: var(--accent);
  box-shadow: 0 0 0 2px #EEF2FF;
}
.action-textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; color: var(--text);
  resize: vertical; outline: none; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s; margin-bottom: 14px;
}
.action-textarea:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px #EEF2FF;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-primary { width: 100%; background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); box-shadow: 0 4px 12px rgb(79 70 229/.3); }
.btn-primary:disabled { background: #A5B4FC; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-ghost {
  background: transparent; color: var(--text-m);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #F3F4F6; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; border-radius: 6px;
}

/* ── Empty State ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px;
  padding: 64px 24px; text-align: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); flex: 1;
}
.empty-title { font-size: 16px; font-weight: 600; }
.empty-sub   { color: var(--text-m); font-size: 13px; max-width: 280px; }

/* ── Run stats (实时 token / 耗时) ── */
.run-stats {
  display: flex; gap: 16px; align-items: center;
  margin: -4px 0 14px; padding: 8px 12px;
  background: #F8FAFC; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.run-stats .stat { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.run-stats .stat-ico { font-size: 13px; }

/* ── Download button ── */
.dl-btn {
  margin-left: auto; text-decoration: none;
  background: var(--accent-lite); color: var(--accent);
  border: 1px solid #C7D2FE; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.dl-btn:hover { background: #E0E7FF; }

/* ── Timeline ── */
.timeline { list-style: none; display: flex; flex-direction: column; }
.tl-item {
  display: grid; grid-template-columns: 20px 1fr auto;
  align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #F3F4F6;
  opacity: .4; transition: opacity .3s;
}
.tl-item:last-child { border-bottom: none; }
.tl-item.active { opacity: 1; }
.tl-item.done   { opacity: .85; }
.tl-item.failed { opacity: 1; }
.tl-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--card);
  transition: border-color .3s, background .3s;
}
.tl-item.active .tl-dot { border-color: var(--accent); }
.tl-item.active .tl-dot::after {
  content: ''; display: block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); margin: 1px;
  animation: pulse 1s infinite;
}
.tl-item.done   .tl-dot { border-color: var(--success); background: var(--success); }
.tl-item.failed .tl-dot { border-color: var(--error);   background: var(--error); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
.tl-label { font-size: 13px; font-weight: 500; }
.tl-status { font-size: 11px; color: var(--text-sm); white-space: nowrap; }
.tl-item.active .tl-label { color: var(--accent); }
.tl-item.done   .tl-label { color: var(--success); }
.tl-item.failed .tl-label { color: var(--error); }

/* ── Compare Slider ── */
.compare-card { padding-bottom: 16px; }
.compare-wrap {
  position: relative; border-radius: var(--radius-sm);
  overflow: hidden; user-select: none; background: #000; aspect-ratio: 1;
}
.compare-img { position: absolute; inset: 0; }
.compare-img img {
  width: 100%; height: 100%; object-fit: contain;
  display: block; pointer-events: none;
}
.compare-before { z-index: 1; }
.compare-after  { z-index: 2; clip-path: inset(0 50% 0 0); transition: clip-path .02s; }
.compare-label {
  position: absolute; bottom: 10px;
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.5); padding: 2px 8px;
  border-radius: 20px; letter-spacing: .5px;
}
.compare-before .compare-label { left: 10px; }
.compare-after  .compare-label { right: 10px; }
.compare-divider {
  position: absolute; top: 0; bottom: 0; z-index: 3;
  left: 50%; transform: translateX(-50%);
  width: 3px; background: #fff;
  box-shadow: 0 0 8px rgba(0,0,0,.4);
  cursor: ew-resize;
  display: flex; align-items: center; justify-content: center;
}
.divider-handle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
}
.compare-slider {
  position: absolute; inset: 0; z-index: 4;
  width: 100%; height: 100%;
  opacity: 0; cursor: ew-resize;
  -webkit-appearance: none; appearance: none;
}

/* ── QC Fail ── */
.qc-fail-header {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; color: var(--error);
  margin-bottom: 12px;
}
.qc-reason {
  font-size: 13px; color: var(--text-m);
  background: #FEF2F2; border: 1px solid #FCA5A5;
  border-radius: var(--radius-sm); padding: 10px 14px;
  margin-bottom: 14px; line-height: 1.6;
}
.qc-fix-wrap {
  background: #FFFBEB; border: 1px solid #FDE68A;
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px;
}
.qc-fix-label { font-size: 11px; font-weight: 600; color: #92400E; margin-bottom: 6px; }
.qc-fix-text  { font-size: 13px; color: #78350F; line-height: 1.6; }
.qc-actions   { display: flex; flex-direction: column; gap: 8px; }

/* ── Error ── */
.error-card { text-align: center; padding: 32px; }
.error-icon { margin-bottom: 12px; }
.error-msg  { font-size: 14px; color: var(--text-m); margin-bottom: 16px; line-height: 1.6; }
.error-raw {
  margin-top: 8px; font-size: 11px; color: var(--text-sm);
  background: #F9FAFB; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; word-break: break-all; text-align: left;
}

/* ── Spinner ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Upload card / thumbnails ── */
.upload-card .card-header { margin-bottom: 14px; }
.thumbs {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px;
}
.thumbs:empty { display: none; }
.thumb {
  position: relative; width: 78px; height: 78px;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: #F9FAFB;
  flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-label {
  position: absolute; left: 4px; bottom: 4px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 1px 7px; border-radius: 10px;
}
.thumb-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.thumb-remove:hover { background: var(--error); }
.thumb--parsing img { filter: brightness(.6); }
.thumb-spinner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.upload-dropzone.drag-over {
  border-color: var(--accent); background: #EEF2FF;
}
.upload-dropzone .upload-placeholder { padding: 24px 16px; }

/* ── Per-image badge ── */
.img-badge {
  font-size: 11px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 2px 9px; border-radius: 10px;
}

/* ── Plan card ── */
.plan-body { display: flex; flex-direction: column; gap: 10px; }
.plan-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.plan-tag {
  font-size: 10px; font-weight: 700; color: #fff;
  padding: 2px 8px; border-radius: 10px;
}
.plan-tag--base { background: var(--accent); }
.plan-tag--ref  { background: var(--warning); }
.plan-block { }
.plan-h {
  font-size: 11px; font-weight: 600; color: var(--text-sm);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.routing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.routing-grid span {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-lite);
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  padding: 6px 8px;
}
.routing-reason {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-m);
}
.copywriting-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.copywriting-box span,
.copywriting-box b {
  font-size: 12px;
  border-radius: 12px;
  padding: 3px 8px;
}
.copywriting-box span {
  color: #065F46;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
}
.copywriting-box b {
  color: #9A3412;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
}
.plan-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.plan-list li {
  font-size: 13px; padding: 6px 10px; border-radius: 6px;
  line-height: 1.5;
}
.plan-list.keep li   { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.plan-list.change li { background: #FFF7ED; color: #9A3412; border: 1px solid #FED7AA; }

/* ── Model selection ── */
.link-btn {
  margin-left: auto; background: none; border: none;
  color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.model-field { margin-bottom: 12px; }
.model-field label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-m);
  margin-bottom: 6px;
}
.model-select {
  width: 100%; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); background: #FAFAFA;
  outline: none; cursor: pointer;
}
.model-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px #EEF2FF; }
.model-hint { font-size: 11px; color: var(--text-sm); margin-top: 2px; }

/* ── Skill chips ── */
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-chip {
  font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-lite);
  border: 1px solid #C7D2FE; padding: 3px 10px; border-radius: 20px;
}

/* ── Analyses (read-only) ── */
.analysis-block {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; background: #FAFAFB;
}
.analysis-block:last-child { margin-bottom: 0; }
.an-label { margin-bottom: 8px; }
.an-row { display: flex; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.an-k { flex-shrink: 0; width: 60px; color: var(--text-sm); font-weight: 600; }
.an-v { color: var(--text); line-height: 1.5; }
.an-styles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.an-style {
  font-size: 11px; color: var(--text-m); background: #EEF2FF;
  border: 1px solid #C7D2FE; padding: 2px 8px; border-radius: 12px;
}

/* ── Plan outputs（多输出）── */
.plan-output {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; background: #FAFAFB;
}
.plan-output:last-child { margin-bottom: 0; }
.plan-output-title { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }

/* ── Results gallery ── */
.results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.result-cell { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.result-thumb { position: relative; aspect-ratio: 1; background: #0b0b0b; cursor: zoom-in; }
.result-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.result-zoom {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border: none; border-radius: 6px;
  background: rgba(0,0,0,.5); color: #fff; cursor: pointer; font-size: 14px;
}
.result-zoom:hover { background: rgba(0,0,0,.75); }
.result-meta { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.result-title { font-size: 12px; font-weight: 600; color: var(--text); }
.qc-badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.qc-badge.pass   { color: #065F46; background: #ECFDF5; border: 1px solid #A7F3D0; }
.qc-badge.reject { color: #9A3412; background: #FFF7ED; border: 1px solid #FED7AA; }
.result-reason { font-size: 11px; color: var(--text-m); padding: 0 10px; line-height: 1.5; }
.result-dl {
  display: block; text-align: center; margin: 8px 10px 10px;
  font-size: 12px; font-weight: 600; text-decoration: none;
  color: var(--accent); background: var(--accent-lite);
  border: 1px solid #C7D2FE; border-radius: var(--radius-sm); padding: 6px;
}
.result-dl:hover { background: #E0E7FF; }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 16px; padding: 32px;
}
.lightbox img { max-width: 90vw; max-height: 80vh; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox-close {
  position: absolute; top: 20px; right: 28px;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 24px; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.lightbox-dl { text-decoration: none; width: auto; padding: 10px 24px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; padding: 16px; }
  .header-badge { display: none; }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
