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

:root {
  --bg: #f8f5f1;
  --surface: #faf8f5;
  --border: #e2ddd6;
  --border-hover: #c9c0b4;
  --text: #2a2622;
  --text-dim: #706456;
  --accent: #c38822;
  --accent-hover: #cc9933;
  --danger: #dc3545;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

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

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(195, 136, 34, 0.05);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(195, 136, 34, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.dropzone-icon svg {
  color: var(--accent);
}

.dropzone-content p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.browse-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* File list */
.file-list {
  list-style: none;
  margin-top: 0.75rem;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.file-info {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--text-dim);
  flex-shrink: 0;
}

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

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

/* Settings */
.settings {
  margin: 1.5rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.settings summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.settings-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.setting label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.slider-val {
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
  font-size: 0.9rem;
  color: var(--accent);
}

/* Tooltips */
.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  background: none;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: help;
  position: relative;
  flex-shrink: 0;
}

.tooltip-trigger .tooltip-content {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text);
  width: 240px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
  line-height: 1.45;
  text-align: left;
}

.tooltip-trigger:hover .tooltip-content,
.tooltip-trigger:focus .tooltip-content {
  display: block;
  animation: tooltip-fade 0.15s ease;
}

@keyframes tooltip-fade {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Submit */
.submit-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Status */
.status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-dim);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Results */
.results {
  margin-top: 1.5rem;
}

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

.results-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.summary {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.download-btn {
  padding: 0.4rem 0.85rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.download-btn:hover {
  border-color: var(--accent);
}

.json-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre;
  color: var(--text);
}

/* Footer */
footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}
