* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #f4f5f7;
  margin: 0;
  padding: 24px 16px;
  color: #1a1a1a;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  min-width: 100px;
  padding: 10px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: #4CAF50;
  border-bottom-color: #4CAF50;
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.hint {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 12px;
}

input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.option-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.option-group.hidden {
  display: none;
}

.option-label {
  font-size: 0.8rem;
  color: #888;
  width: 100%;
  margin-bottom: -4px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.pages-field {
  margin-bottom: 16px;
}

.pages-field input[type="text"] {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-top: 6px;
}

.preview-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  cursor: grab;
}

.preview-item.dragging {
  opacity: 0.4;
}

.preview-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #eee;
}

.preview-name {
  flex: 1;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.preview-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  color: #555;
}

.preview-btn:hover {
  background: #f0f0f0;
}

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

.run-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}

.run-btn:disabled {
  background: #a5d6a7;
  cursor: not-allowed;
}

.status {
  margin-top: 16px;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.status.error { color: #c62828; }
.status.ok { color: #2e7d32; }
