:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-sub: #6b7280;
  --primary: #667eea;
  --primary-hover: #5a6fd6;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f23;
    --surface: #1a1a2e;
    --text: #e2e8f0;
    --text-sub: #94a3b8;
    --border: #2d2d44;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

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

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

header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

nav { max-width: 800px; margin: 0 auto; }

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  text-decoration: none;
}

main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.subtitle { color: var(--text-sub); margin-bottom: 1.5rem; }

/* 옵션 */
.options {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.options label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.options select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
}

.range-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-wrapper input[type="range"] {
  width: 120px;
  accent-color: var(--primary);
}

.range-wrapper span {
  font-weight: 600;
  color: var(--text);
  min-width: 3ch;
}

/* 드롭존 */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.05);
}

.dropzone-content svg { color: var(--text-sub); margin-bottom: 1rem; }
.dropzone-content p { font-size: 1rem; margin-bottom: 0.25rem; }
.hint { font-size: 0.8rem; color: var(--text-sub); }

/* 결과 */
.results { margin-top: 2rem; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.results-header h2 { font-size: 1.25rem; }

.btn-clear {
  padding: 0.35rem 0.75rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-sub);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-clear:hover { border-color: #ef4444; color: #ef4444; }

.result-list { display: flex; flex-direction: column; gap: 0.75rem; }

.result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.result-item .thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.result-item .info { flex: 1; min-width: 0; }

.result-item .filename {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item .sizes { font-size: 0.8rem; color: var(--text-sub); }

.result-item .format-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(102, 126, 234, 0.1);
  color: var(--primary);
}

.result-item .actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.result-item .btn-download {
  padding: 0.4rem 0.8rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

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

.btn-remove {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.btn-remove:hover { color: #ef4444; }

.result-item.processing { opacity: 0.7; }

.result-item .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.btn-download-all {
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

footer {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  main { padding: 1.5rem 1rem; }
  .dropzone { padding: 2rem 1rem; }
  .result-item { flex-wrap: wrap; }
  .options { flex-direction: column; gap: 1rem; }
}
