:root {
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --bg: #f7f6fb;
  --card-bg: #ffffff;
  --text: #1f1a2e;
  --muted: #6b6478;
  --border: #e4e1ec;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.header {
  padding: 28px 20px 20px;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 6px 0 0;
  opacity: .85;
  font-size: .9rem;
}

.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

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

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

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.hint {
  color: var(--muted);
  font-size: .88rem;
  margin: 0 0 16px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field select,
.field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  background: #fff;
  color: var(--text);
}

.field select:focus,
.field input[type="text"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

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

.drop-zone.drag-over {
  border-color: var(--primary);
  background: #f4effe;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.drop-icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.hint-small {
  font-size: .78rem;
  margin: 0;
  color: var(--muted);
}

.file-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: .88rem;
}

.file-row .file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .file-size {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}

.file-row .file-status {
  font-size: .78rem;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1eefb;
  color: var(--primary);
}

.file-row .file-status.done { background: #e7f7ec; color: var(--success); }
.file-row .file-status.error { background: #fdeceb; color: var(--danger); }

.file-row .remove-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background .15s;
}

.btn-primary:disabled {
  background: #cfc7e4;
  cursor: not-allowed;
}

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

.btn-secondary {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: .92rem;
  cursor: pointer;
  margin-top: 10px;
}

.upload-progress {
  margin-top: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

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

.upload-progress p {
  margin: 8px 0 0;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

.upload-summary {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: #f4effe;
  font-size: .9rem;
}

.upload-summary.has-errors {
  background: #fdf3ec;
}

.upload-summary .summary-title {
  font-weight: 600;
  margin: 0 0 6px;
}

.upload-summary ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
  color: var(--danger);
  font-size: .8rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (min-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #eee7fa;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item .video-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: .7rem;
}

.gallery-item.processing {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item.processing .spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}
