:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --red-500: #ef4444;
  --green-500: #22c55e;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(37, 99, 235, 0.08);
  --shadow-lg: 0 10px 30px rgba(37, 99, 235, 0.15);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  background: linear-gradient(180deg, var(--blue-50) 0%, var(--white) 320px);
  color: var(--gray-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  padding: 48px 0 24px;
}
.site-header h1 {
  margin: 0 0 8px;
  font-size: 2.25rem;
  color: var(--blue-900);
  letter-spacing: -0.02em;
}
.tagline {
  margin: 0;
  color: var(--gray-600);
  font-size: 1.05rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.controls {
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin-bottom: 20px;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.control-group > label {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.95rem;
}
.resolution-buttons {
  display: inline-flex;
  background: var(--blue-50);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.res-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue-700);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.res-btn:hover { background: var(--blue-100); }
.res-btn.active {
  background: var(--blue-600);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.res-btn:active { transform: scale(0.97); }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
}
.checkbox input { accent-color: var(--blue-600); width: 16px; height: 16px; }

.dropzone {
  background: var(--white);
  border: 2px dashed var(--blue-200);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.dropzone.dragover {
  border-color: var(--blue-600);
  background: var(--blue-100);
  transform: scale(1.005);
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--blue-700);
  pointer-events: none;
}
.upload-icon { color: var(--blue-500); margin-bottom: 6px; }
.dz-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
}
.dz-sub { margin: 0; color: var(--gray-600); font-size: 0.95rem; }
.link { color: var(--blue-600); text-decoration: underline; }

.files { margin: 32px 0 64px; }
.files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.files-header h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--blue-900);
}
.empty-state {
  color: var(--gray-400);
  font-size: 0.95rem;
  text-align: center;
  padding: 32px 0;
}
.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.file-card {
  background: var(--white);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.file-card:hover { box-shadow: var(--shadow-md); }
.thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(45deg, var(--gray-100) 25%, transparent 25%),
    linear-gradient(-45deg, var(--gray-100) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--gray-100) 75%),
    linear-gradient(-45deg, transparent 75%, var(--gray-100) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: var(--white);
  border-radius: 8px;
  border: 1px solid var(--blue-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.thumb img { max-width: 100%; max-height: 100%; }

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.file-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info { font-size: 0.8rem; color: var(--gray-600); }

.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.status {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--blue-700);
}
.status.success { background: rgba(34, 197, 94, 0.12); color: var(--green-500); }
.status.error { background: rgba(239, 68, 68, 0.12); color: var(--red-500); }

.btn {
  appearance: none;
  border: 0;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn-primary {
  background: var(--blue-600);
  color: var(--white);
}
.btn-primary:hover { background: var(--blue-700); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--blue-50);
  color: var(--blue-700);
}
.btn-secondary:hover { background: var(--blue-100); }
.btn:active { transform: scale(0.97); }

.site-footer {
  padding: 24px 0 40px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
}

@media (max-width: 540px) {
  .site-header { padding: 32px 0 16px; }
  .site-header h1 { font-size: 1.75rem; }
  .controls { padding: 16px; gap: 16px; }
  .dropzone { padding: 32px 16px; }
}
