:root {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1a1a1a;
  background: #eceae4;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --sidebar-bg: #fafafa;
  --border: #ddd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.app {
  display: flex;
  min-height: 100vh;
  gap: 12px;
  padding: 12px;
}

.sidebar {
  width: 320px;
  min-width: 310px;
  max-width: 340px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 24px);
  font-size: 13px;
}

.group {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.group h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #333;
}

.group label {
  display: block;
  margin: 6px 0;
}

.group input[type="number"],
.group select {
  width: 100%;
  margin-top: 4px;
  padding: 4px 6px;
}

.group input[type="range"] {
  width: 100%;
}

.scale-val {
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  margin: 4px 0;
}

.note {
  color: #666;
  font-size: 11px;
  margin: 4px 0;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.badge.cloud {
  background: #eff6ff;
  color: var(--primary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
}

.dropzone {
  border: 2px dashed #888;
  border-radius: 12px;
  background: #f7f7f7;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.dropzone.hover,
.dropzone:focus-visible {
  border-color: var(--primary);
  background: #eff6ff;
  outline: none;
}

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

.muted {
  color: #999;
  font-size: 11px;
}

.file-count {
  font-weight: bold;
  margin: 0;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 110px;
  overflow-y: auto;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.file-list li {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.file-list li.active {
  background: #eff6ff;
  font-weight: 600;
}

.preview-panel {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.preview-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.preview-nav span {
  flex: 1;
  text-align: center;
  font-weight: 600;
  color: #444;
  font-size: 13px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
}

.preview-grid figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.preview-grid figcaption {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}

.preview-grid img {
  flex: 1;
  width: 100%;
  min-height: 200px;
  max-height: 360px;
  object-fit: contain;
  background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.hint {
  font-size: 10px;
  color: #666;
  margin: 8px 0 0;
}

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

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  background: #fff;
}

.btn.secondary:hover {
  background: #f5f5f5;
}

.btn.primary {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: bold;
}

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

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

.status {
  min-height: 1.25rem;
  color: #555;
  font-size: 13px;
}

.status.error {
  color: #b91c1c;
}

.progress-wrap.hidden {
  display: none;
}

.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

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

#progressText {
  font-size: 12px;
  color: #666;
  margin: 4px 0 0;
}

@media (max-width: 900px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    max-width: none;
    max-height: none;
  }
  .preview-grid {
    grid-template-columns: 1fr;
  }
}
