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

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-secondary: #6c757d;
  --primary: #4361ee;
  --primary-hover: #3a56d4;
  --success: #2ec4b6;
  --error: #e63946;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  text-align: center;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
}

header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

main {
  max-width: 800px;
  margin: 32px auto;
  padding: 0 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(67, 97, 238, 0.04);
}

.drop-zone-icon {
  font-size: 40px;
  margin-bottom: 8px;
  display: block;
}

.drop-zone-text {
  font-size: 15px;
  font-weight: 500;
}

.drop-zone-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.file-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e9ecef;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.file-tag-remove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 14px;
  line-height: 1;
}

.file-tag-remove:hover {
  opacity: 1;
}

.settings-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-row label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.settings-row input,
.settings-row select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--surface);
}

.settings-row input {
  flex: 1;
  min-width: 160px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: #f1f3f5;
}

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

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.preview-icon {
  font-size: 21px;
  line-height: 1;
}

.preview-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  word-break: break-all;
  max-width: 100%;
}

.css-snippet {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px;
  border-radius: 6px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  margin-top: 12px;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #cdd6f4;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.2);
}

.error-msg {
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: var(--error);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
}

.loading {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.hidden {
  display: none;
}

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