:root {
  color-scheme: light;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 12px;
  color: #17211d;
  background: #eef5ef;
  font-synthesis: none;
}

* { box-sizing: border-box; }

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

body { margin: 0; background: #eef5ef; }

button,
textarea { font: inherit; letter-spacing: 0; }

button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #eef5ef;
}

.workspace {
  flex: 1 0 auto;
  min-width: 0;
  min-height: calc(100vh - 42px);
  display: grid;
  grid-template-rows: 76px 1fr;
  background: #eef5ef;
}

.site-footer {
  min-height: 42px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-top: 1px solid #d7ded9;
  color: #66736c;
  background: #f8faf8;
  font-size: 11px;
  text-align: center;
}

.site-footer a {
  color: #52635a;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible { text-decoration: underline; }

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(28px, 4vw, 64px);
  border-bottom: 1px solid #d7ded9;
  background: #dfece3;
}

.top-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar { display: none; }

.nav-button {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #c9d4ce;
  border-radius: 6px;
  color: #30443a;
  background: #f8fbf8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.nav-button:hover { background: #f1f6f3; }

.nav-button.active {
  border-color: #146c43;
  color: #ffffff;
  background: #146c43;
}

h1,
h2 { margin: 0; letter-spacing: 0; }

h1 { font-size: 17px; line-height: 1.25; }
h2 { font-size: 14px; }

.workspace-content {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 34px clamp(28px, 4vw, 64px) 40px;
}

@media (max-width: 720px) {
  .workspace { grid-template-rows: auto 1fr; }
  .workspace-header {
    min-height: 108px;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 18px;
    padding-bottom: 16px;
  }
  .top-nav { width: 100%; }
}

.search-form {
  width: 100%;
  padding: 24px;
  border: 1px solid #d4ddd7;
  border-radius: 8px;
  background: #fbfdfb;
  box-shadow: 0 8px 24px rgba(26, 52, 41, 0.06);
}

label {
  display: block;
  margin: 0 0 10px;
  color: #34423a;
  font-size: 12px;
  font-weight: 700;
}

.paste-area {
  position: relative;
  overflow: hidden;
  border: 1px solid #bcc8c1;
  border-radius: 7px;
  background: #fbfdfb;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.paste-area:focus-within {
  border-color: #146c43;
  box-shadow: 0 0 0 3px rgba(20, 108, 67, 0.11);
}

.paste-area.dragging {
  border-color: #146c43;
  background: #f1f7f3;
}

textarea {
  width: 100%;
  min-height: 156px;
  display: block;
  padding: 16px 18px;
  border: 0;
  resize: vertical;
  background: transparent;
  color: #17211d;
  outline: none;
  line-height: 1.65;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
}

textarea::placeholder { color: #9aa49e; }

.paste-hint {
  min-height: 36px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px;
  border-top: 1px solid #e3e8e5;
  color: #78857e;
  background: #fafbfa;
  font-size: 12px;
}

.image-preview {
  position: relative;
  margin: 0 16px 14px;
  padding: 10px;
  border: 1px solid #e0e6e2;
  border-radius: 5px;
  background: #f7f9f8;
}

.image-preview img {
  width: 100%;
  max-height: 170px;
  display: block;
  object-fit: contain;
}

.remove-image {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #cbd5cf;
  border-radius: 50%;
  background: #fbfdfb;
  color: #35443c;
  font-size: 21px;
  line-height: 1;
}

.form-actions {
  min-height: 48px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.selection-count {
  color: #68756e;
  font-size: 11px;
}

.primary-button {
  min-width: 180px;
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid #146c43;
  border-radius: 7px;
  background: #146c43;
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover { background: #0f5937; }
.primary-button:disabled { cursor: wait; opacity: 0.68; }

.search-progress {
  margin-top: 14px;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #5f6c65;
  font-size: 11px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #dce4df;
}

.progress-fill {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #146c43;
  transition: width 420ms ease;
}

.form-message {
  min-height: 18px;
  margin: 8px 0 0;
  color: #a1342b;
  font-size: 11px;
}

.results {
  min-height: 260px;
  flex: 1;
  padding-top: 26px;
}

.results-heading {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #647069;
  font-size: 11px;
}

.results-heading h2 { color: #17211d; }

.result-list {
  min-height: 210px;
  border: 1px solid #d3dbd6;
  border-radius: 8px;
  background: #fbfdfb;
  box-shadow: 0 8px 24px rgba(26, 52, 41, 0.04);
}

.empty-result {
  min-height: 210px;
  display: grid;
  place-items: center;
  color: #b0b9b4;
  font-size: 22px;
}

.result-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 13px 16px;
  border-bottom: 1px solid #dbe2de;
}

.result-row:last-child { border-bottom: 0; }

.bundle-value {
  overflow-wrap: anywhere;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 11px;
  font-weight: 700;
}

.status-text { color: #5f6c65; font-size: 11px; }
.status-text.found { color: #146c43; }
.status-text.error { color: #a1342b; }

.row-actions { display: flex; gap: 8px; }

.row-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid #bdc9c2;
  border-radius: 5px;
  color: #26352d;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.row-link.primary {
  border-color: #146c43;
  color: #146c43;
}

.row-link:hover { background: #f1f5f2; }

.loading-row {
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #5f6c65;
  background: #fbfdfb;
}

.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid #cbd8d0;
  border-top-color: #146c43;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

[hidden] { display: none !important; }

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

@media (max-width: 840px) {
  .workspace { grid-template-rows: 64px 1fr; }
  .workspace-header { padding: 0 24px; }
  .workspace-content { padding: 24px; }
  .search-form { padding: 20px; }
}

@media (max-width: 560px) {
  .workspace { grid-template-rows: 58px 1fr; }
  .workspace-header { padding: 0 16px; }
  .workspace-content { padding: 20px 14px 24px; }
  h1 { font-size: 17px; }
  textarea { min-height: 132px; padding: 14px; }
  .search-form { padding: 16px; }
  .form-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .primary-button { width: 100%; }
  .results { padding-top: 18px; }
  .result-row { grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 14px; }
  .row-actions { margin-top: 4px; }
  .row-link { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; }
  .progress-fill { transition: none; }
}
