:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --subtle: #f8fafc;
  --border: #e2e8f0;
  --border-hover: #94a3b8;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.header {
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header p {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: var(--subtle);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  outline: none;
}

.dropzone.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.drop-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.drop-icon svg {
  width: 24px;
  height: 24px;
}

.drop-title {
  font-size: 15.5px;
  font-weight: 600;
}

.drop-sub {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.drop-sub code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

.loading-bar {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.error-box {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

/* Results */
.result-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.btn-text {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--danger);
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.thumb-wrap {
  width: 88px;
  height: 124px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #e2e8f0;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  padding: 6px;
  cursor: zoom-in;
}

.thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.14);
}

.item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  font-size: 12.5px;
  color: var(--muted);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.btn-download:hover {
  background: var(--primary-hover);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
}

.modal-box {
  position: relative;
  background: #fff;
  padding: 14px;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
}

.modal-box img {
  max-width: 82vw;
  max-height: 82vh;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

@media (max-width: 560px) {
  .page {
    padding-top: 28px;
  }
  .result-item {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .thumb-wrap {
    margin: 0 auto;
  }
}
