:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 32px 16px 16px;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 64px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.dropzone-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.dropzone-or {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.file-button {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.file-button:hover {
  background: var(--primary-hover);
}

.dropzone-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 16px;
}

.progress {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}

.progress-bar {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.3s;
}

#progressText {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.results {
  margin-top: 16px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-header h2 {
  font-size: 20px;
}

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

.results-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.button {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 14px;
  transition: background 0.2s;
}

.button-primary {
  background: var(--primary);
  color: white;
}

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

.button-primary:disabled {
  background: var(--secondary);
  cursor: not-allowed;
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  background: var(--bg);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.result-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg);
  display: block;
}

.result-body {
  padding: 10px 12px;
}

.result-name {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.result-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface);
  cursor: pointer;
}

.result-select.changed {
  border-color: var(--primary);
  background: #eff6ff;
}

.result-error {
  color: #dc2626;
  font-size: 12px;
  padding: 6px 0;
}

.hidden { display: none !important; }

footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 12px;
}
